I'm using maven-war-plugin to generate a WAR file.
In the dependency hierarchy, I can see many transitive dependencies, which are extract in the lib folder.
After many research, I saw that the easiest way to exclude them from the war lib folder is to declare them as 'provided' in my dependencies.
However, I have a lot of dependencies to exclude, and I have to do this in many WAR pom file.
My question is :
Is there a way to group all these dependencies in a 'pom' packaging, and use this new artifact in my WAR pom file ?
If I understand your needs...
try this--> http://maven.apache.org/plugins/maven-war-plugin/examples/including-excluding-files-from-war.html
when you build the war you can exclude all dependencies you want in this way:
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<!--
Exclude JCL and LOG4J since all logging should go through SLF4J.
Note that we're excluding log4j-<version>.jar but keeping
log4j-over-slf4j-<version>.jar
-->
<packagingExcludes>
WEB-INF/lib/commons-logging-*.jar,
%regex[WEB-INF/lib/log4j-(?!over-slf4j).*.jar]
</packagingExcludes>
</configuration>
</plugin>
</plugins>