You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jörg Henke <jo...@uni-greifswald.de> on 2011/11/29 16:57:59 UTC

Tomcat Maven Integration

Hi there,

just a question as I'm not familiar with tomcat developement and maven 
integration; I think this is a developement topic to be discussed or at least 
to be thought of.

Is it possible to make tomcat use its own maven repository inside? This would 
mean if I generate a war file to be deployed, I don't package the needed libs 
referenced in maven, for tomcat should provide them.

Then tomcat is to look into the war file, check the pom.xml and get the libs 
from maven repository itself to make sure that the web application can use the 
needed libs.

There might be conflicts between two releases of a lib; this must be handled by 
such a tomcat maven plugin. As the war defines the release version in its maven 
config file, tomcat is to be able to use the specified one instead of only 
looking for the right package.

The benefit would be smaller war files and only one lib for many projects.

So here again my question: is it possible to do it this way or, if not, is 
this "feature" to be implemented (at least as a module for tomcat)?

Thanks for any reply

Jörg Henke

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Tomcat Maven Integration

Posted by Mark Thomas <ma...@apache.org>.
On 29/11/2011 15:57, Jörg Henke wrote:
> Hi there,
> 
> just a question as I'm not familiar with tomcat developement and maven 
> integration; I think this is a developement topic to be discussed or at least 
> to be thought of.
> 
> Is it possible to make tomcat use its own maven repository inside? This would 
> mean if I generate a war file to be deployed, I don't package the needed libs 
> referenced in maven, for tomcat should provide them.
> 
> Then tomcat is to look into the war file, check the pom.xml and get the libs 
> from maven repository itself to make sure that the web application can use the 
> needed libs.
> 
> There might be conflicts between two releases of a lib; this must be handled by 
> such a tomcat maven plugin. As the war defines the release version in its maven 
> config file, tomcat is to be able to use the specified one instead of only 
> looking for the right package.
> 
> The benefit would be smaller war files and only one lib for many projects.
> 
> So here again my question: is it possible to do it this way or, if not, is 
> this "feature" to be implemented (at least as a module for tomcat)?

There is currently no such feature.

There are currently no plans to implement such a feature.

Dependency resolution is a non-trivial problem that Maven has already
solved and I'd rather not see all that functionality copied into Tomcat.

Shared JARs are notoriously problematic. Much better to have one JAR per
webapp. The memory savings are rarely worth the hassle (although you can
configure Tomcat with a shared classloader if you wish).

In terms of reducing JWAR size, while Tomcat can't resolve dependencies,
you could use [1] to pick up JARs from a local repository (which could
result in shared JARs on disk but not in memory) rather than packaging
them per application. The dependency resolution could still be done at
build time with the build tool configuring [1] rather than adding JARs
to WEB-INf/lib. This

Mark

[1]
http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org