Hi Alexi,

The way we've done this is to package the applicationContext.xml in the war - not in the jar. You can do this by adding it to the war's src/main/resources directory. In order to run unit tests in the jar module, we have added an applicationContext.xml in the jar's src/test/resources directory.

Keeping the applicationContext.xml out of the jar will help keep weird class path issues from cropping up if you try to 'override' it. Plus, we feel like it's the top most package's responsibility to configure the spring environment. There's probably a better way to do it, so hope that others will chime in with their ideas as well.

One other suggestion is to use JNDI to supply your DataSource instead of having a jndi.properties file. This way you don't have to unpack the war to make configuration changes - they'll be part of the container's configuration. The more you can delegate to the container the less you have to fiddle with at deployment time.

Hope this helps,

Joe Hindsley


Alexi Polenur wrote:
Hi all,

I am trying to setup a multi-module project. One module produce a JAR
(jar-module) and another one a WAR which uses jar produced by "jar-module".

jar-modules has some configuration files - Spring xml and .property files.
Rather then package them as part of the jar I wanted to deploy them into
WEB-INF/classes directory of the war, to allow end user easy customization.

I am new to Maven and wondering what is the best way to do it.

First thing which comes to my mind is following.

1. Make jar module produce additional artifacts, let say jdbc.properties and
applicationContext.xml
2. Make WAR module depend not only on jar but also on additional artifacts
above.
3. Somehow configure WAR module build process to get this artifacts from
repository and install them into WEB-INF/classes of the war file.

Is it right approach or there is better, simpler approach.

If it is right approach can somebody point me in direction of how to achieve
it. Such as how I install additional artifacts in 1. above and then how I do
3.

Thanks, Alexi


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to