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
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: 17417

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Config file
It's not a secret anymore!