This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Config file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Config file" Watch "Config file" New topic

Config file

Anand Lachu

Joined: Nov 05, 2012
Posts: 1
We are using maven build tool.
Currently we have our configuration inside war file, which contains all URLs
Requirement is that war file should not contain the configurations, should be outside war

Some one please help
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16476

Welcome to the JavaRanch, Anand!

Maven produces only one product per project (POM). If you use the WAR goal, that product will be the WAR and only the WAR - no external files.

What I generally do is create an OS install package, such as a Red Hat RPM. By configuring my POM to create the WAR as part of an RPM package, I can construct an OS deployable component (RPM) using only the Maven command "mvn clean package". The RPM's file list includes the config file prototypes and the RedHat Package Manager program will automatically copy them to their proper destinations - as it will for the WAR itself. You define what the "proper destinations are"; I normally copy the WAR to /opt/vendorname/productname, a Context file to my TOMCAT conf/Catalina/localhost directory, the config files to /etc/vendorname.d, and any workfiles to /var/lib/productname. Depending on project needs.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: Config file