This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Conditional dependency Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Conditional dependency" Watch "Conditional dependency" New topic

Conditional dependency

Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 642

I have to add an dependency for JTA jar files and one conf folder (under <resources> tag) , but only when i build it for tomcat, how can i achieve this in pom.xml ?


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

Use the Maven profile facility. Define one or more profiles in the POM with the extra stuff in them and use the "-P" option on Maven to activate the profile when you need to.

I've been using this for things like building test apps for Tomcat when the production build is an IBM iSeries.

An IDE is no substitute for an Intelligent Developer.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 642
thanks much Tim will try it
I agree. Here's the link:
subject: Conditional dependency
jQuery in Action, 3rd edition