This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Conditional dependency" Watch "Conditional dependency" New topic
Author

Conditional dependency

Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 641
Hi,

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 ?

-P


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

Joined: Jun 25, 2001
Posts: 17151
    
  27

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: 641
thanks much Tim will try it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Conditional dependency
 
It's not a secret anymore!