Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Where should tomcat base configuration be located in Eclipse using Sonatype Webby Plugin?

If I understand correctly you need put some resources (config files) on the runtime classpath of your application, but you don't want them to be packaged in WAR.

If this is so, here's a simple solution: create a configuration directory in your WAR project and include it as resource conditionally, using dedicated maven profile. You can then enable this profile on an Eclipse project using Properties > Maven dialog.

If you need to tweak Tomcat itself, like adding connectors or datasources to server.xml there's another workable, but more cumersome approach.

Take a look at target/m2e-webby/container/conf/server.xml There's a <Context> element in there, generated by Webby. Copy it and paste it into server.xml of an external Tomcat installation tweked to your needs. This way, your external tomcat installation will pick up classes recompiled by Eclipse and resource changes in the WAR and it's overlays. Of course you can combine this setup with JRebel for instant class reloading. The downside is that you need to start / stop the external tomcat instance manually and that you need to repeat the copying of <Context> element whenever project structure (modules) or dependencies change, which may be a problem or not depending on the stage your project is in.

Cheers,
Rafał

On 02/08/2012 01:20 AM, Benjamin Bentmann wrote:
Asaf Mesika wrote:

I need to put several files in tomcat/conf directory (log4j.properties, acme.proeprties, etc) which my WAR reads from the classpath (since conf is in the classpath).

That the conf dir ends up on the classpath kinda surprises me, given the info I find on [0], but then again, I'm not really familar with Tomcat.

I did place them in my installed tomcat location (~/tomcat/conf), and when I created a new Webby Launch Configuration I referenced ~/tomcat directory, but from some reason the target/m2e-webby/container/conf doesn't include my log4j.properties and acme.properties files. When I try to copy them to target/m2e-webby/container/conf it gets erased as soon as I launch Webby.

The container configuration is under tight control of Webby/Cargo, you currently have little to no means to change that.

Looking at the catalina.properties that get used for Tomcat 6.x and 7.x, the only way that I see to solve your issue is to place the files into ${catalina.home}/lib such that they end up in Tomcat's common class loader.

That not working for you, I can only suggest to look at other web integrations like m2e-wtp.


Benjamin


[0] http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top