I think there is a disconnect somewhere as I have noticed a lot of requests
similar to mine but I haven't really seen an 'elegant' solution for it so
here goes!

Let's make up an example that may highlight the problem a little more.

*myproject-gui *(lets not worry whats in here for now)
*myproject-common* (contains java utility and shared api between server and
gui.  This is a code only project.. no configuration in here.)
*myproject-server *(server side code that must be configured to move it
through environments)

Let's break down the server project:

*myproject-server/*
  /- src/main/java/ /(java code, implements lots of 3rd party products plus
my own business logic)
  /- src/main/resources/ (static content, but in this case to avoid
confusion lets say it is empty)
  /- pom.xml /(only contains third party dependencies)

So far we only have seen binary projects.  Now on to how we configure it:

*myproject-build/*
 / - src/main/config /(contains third party configuration files.  Lets
pretend for now this is logback.xml, spring-applicationContext.xml, and
other proprietary configurations that i want to change the values of through
the different environments.  One alternative is to use filters applied to
property place holders and the other is to have all configuration in
different folders marked by environment)
  /- src/sql /(sql files for setting up different environments.. i use the
mvn sql plugin whose properties are configured from my settings.xml)
  /- src/scripts /(scripts that also have to be configured per environment,
different JAVA_HOME's, different VM options etc)
  /- src/assembly/ (creates my tarball artifact which is made up of
myproject-server depdencies into a lib directory, an empty logs directory
and a bin and config direction (the config dir is added to the classpath).
  /- pom.xml /(only sepcifies myproject-server as a dependency and has lots
of build plugins)

/*Like most others i am using maven to provide a mechanism to not only build
my projects, but also configure them for different runtime environments.*/. 
I can't seperate out configuration completely otherwise developers cannot
work on their projects in their IDE (eclipse, intellij) and i have to hunt
another configuration mechanism for my other environments (JNDI, databases
etc.).  If there is an easy way to do this with maven and eclipse so that
it's seemless im all ears!

Given my example project and that i have already seperated out my binaries
from my configuration:
*
1) How can i use maven in a nice way to configure my properties, both during
development and when deploying to various environments?*
*2) How do i  set third party properties (e.g. what is my log level for
log4j? what appender will i use? etc.) using this properties on the
classpath technique that you mention?*  These third party properties get
read directly by their own jars/api's so i don't understand how to property
replace this at runtime (which is what i think you are saying).



As a side note: Lot's of other posters tend to place their configuration via
profile properties into their jars.  I agree this practice is bad but i can
see why they do it as based on how maven is documented and there lacks an
easy to understand alternative to doing this.  It also doesn't help that no
one has really refuted the 'ant way' in the online doc.

--
View this message in context: 
http://maven.40175.n5.nabble.com/Maven-environment-configurations-tp4586719p4587318.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to