Global transitive depedency exclude

View: New views
4 Messages — Rating Filter:   Alert me  

Global transitive depedency exclude

by chicagopooldude :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am working on getting a war file from our project using maven, we initially had around 120+ jars in lib which have become cluttered that's one of the reasons to move to Maven. Now due to transitive dependencies we have around 180+ jars in web-inf/lib. I have tried excluding each transitive jars using dependency:tree method with success. I wanted to know if there is any other way to globally disable transitive dependency in the whole project because there are times when two versions of jars  in lib which causes problems while deployed war runs on server. Also I have seen <useTransitiveDependencies>true</useTransitiveDependencies> in assembly plugin can this be used to build war minus all the jars which we dont need?. Any help is appreciated and thanks for seeing this post.

RE: Global transitive depedency exclude

by justinedelson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The war plugin doesn't support useTransitiveDependencies. It does,
however, support packagingIncludes and packagingExcludes, which can be
used to limit which files get placed into the WAR file. See
http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.ht
ml

Justin

-----Original Message-----
From: chicagopooldude [mailto:Seshu.Pitcha@...]
Sent: Tuesday, October 27, 2009 10:56 AM
To: users@...
Subject: Global transitive depedency exclude


I am working on getting a war file from our project using maven, we
initially had around 120+ jars in lib which are have become cluttered
that's one of the reason to move to Maven. Now due to transitive
dependencies we have around 180+ jars in web-inf/lib. I have tried
excluding each transitive jars using dependency:tree method with
success. I wanted to know if there is any other way to globally disable
transitive dependency in the whole project because there are times when
two versions of jars are there in lib which causes problems while
deployed war runs on server. Also I have seen
<useTransitiveDependencies>true</useTransitiveDependencies> in assembly
plugin can this be used to build war minus all the jars which we dont
need?.
Any help is appreciated and thanks for seeing this post.
--
View this message in context:
http://www.nabble.com/Global-transitive-depedency-exclude-tp26079185p260
79185.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Global transitive depedency exclude

by chicagopooldude :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Currently after looking around i did not find any Global transitive dependency exclude in maven. So i used mvn dependency:tree and see where the jar that being pulled from and use excludes to main parent pom under dependencyManagement.


chicagopooldude wrote:
I am working on getting a war file from our project using maven, we initially had around 120+ jars in lib which have become cluttered that's one of the reasons to move to Maven. Now due to transitive dependencies we have around 180+ jars in web-inf/lib. I have tried excluding each transitive jars using dependency:tree method with success. I wanted to know if there is any other way to globally disable transitive dependency in the whole project because there are times when two versions of jars  in lib which causes problems while deployed war runs on server. Also I have seen <useTransitiveDependencies>true</useTransitiveDependencies> in assembly plugin can this be used to build war minus all the jars which we dont need?. Any help is appreciated and thanks for seeing this post.

Re: Global transitive depedency exclude

by Wayne Fay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> because there are times when two versions of jars are there in lib which
> causes problems while deployed war runs on server. Also I have seen

I saw your follow up post and wanted to let you know one common way
that two versions of jars end up in your war's lib directory...

Suppose an artifact "xyz" was using groupId "abc" until version 2.0.4,
and then switched over to "com.abc" for version 2.0.5 and above. Some
dependencies might pull in abc:xyz:2.0.1 while others pull in
com.abc:xyz:2.0.5. Maven does not realize those are different versions
of the "same" artifact, so the usual dependency resolution process
does not work as it should.

The only way to deal with this is to analyze your dependency tree and
prune the unwanted artifacts, which is just what you said you are
doing.

Another common way this happens is when you run "mvn package"
repeatedly, and change versions of dependencies etc but then never run
"mvn clean" so your /target folder is full of older build dependencies
that are no longer being used. You should run "mvn clean" periodically
to clean things up, or even better, use a continuous integration
server (Hudson etc) that ensures your builds are clean every time they
are performed.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...