Maven - application configuration

G

Guest

I have standard maven directory structure for my modular java project:
doss-client/
doss-client/doss-client-common/ - common module for application
doss-client/doss-client-watchdog/ - some other modules
doss-client/doss-client-showtime/ - ...
doss-client/doss-client-update/ - ...

Each module again has standard maven dir structure:
/src
/target
....

My final app directory structure should be like this:
/etc/doss/ - all config files (config.xml, ...)
/opt/doss/ - application binaries, ...
/var/log/ - log files (doss.log, ...)
/tmp/doss/ - temp files

As you can see, i will deploy my app in linux environment.

QUESTION: How to configure maven to deploy it preserving this dir
structure? Also I don't know how to tell my java app, to look for
config files in /etc/doss/. Or do I have to use simply absolute path?

Thanks,
Paul
 
T

Thomas Weidenfeller

Pavol said:
My final app directory structure should be like this:
/etc/doss/ - all config files (config.xml, ...)

XML for config data? People never learn ... :-(
/opt/doss/ - application binaries, ...
/var/log/ - log files (doss.log, ...)
/tmp/doss/ - temp files

As you can see, i will deploy my app in linux environment.

QUESTION: How to configure maven to deploy it preserving this dir
structure?

One typically does not use the build system for deployment, because it
is for building things, not deploying them. You use it to build an
installation package (of whatever kind you prefer, e.g. for Web Start).
Then you deploy that installation package. A side effect of this is that
you get parts of the installation package tested early.

Also I don't know how to tell my java app, to look for
config files in /etc/doss/.

Hard-code the path into your application or make it a command line
option (plus a wrapper script setting it). This will of course thwart
deployment on non *nixoid platforms. The cross-platform way would be to
use the preferences API, properties files carefully loaded based on the
system properties like user.dir, or properties files in the classpath
loaded via getResources().

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top