You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mirko Friedenhagen <mi...@friedenhagen.de> on 2009/12/05 20:29:44 UTC

Maven Plugin to detect duplicate class files in a e.g. WAR

Hello,

sometimes dependencies change their groupId (e.g. commons-io and org.apache.commons or spring vs. org.springframwork). Maven now has no chance(?!) to detect duplicate JARs with different versions during dependency resolution and puts jars with different versions in a war. In the end you are not sure which class will be loaded in a webapp.

Do you know a plugin which will detect such jar/class collisions?

Best Regards
Mirko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven Plugin to detect duplicate class files in a e.g. WAR

Posted by Stevo Slavić <ss...@gmail.com>.
maven-shade-plugin's shade
goal<http://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html>will
display warnings for duplicate classes when generating uber-jar.
Stephen, maybe you can reuse some parts of the logic from there for the new
mojo.

Regards,
Stevo.

On Sat, Dec 12, 2009 at 9:13 PM, lukewpatterson <lu...@gmail.com>wrote:

>
>
> Mirko Friedenhagen wrote:
> >
> > goal to check classpath for duplicate resources/classes
> >
>
> I haven't tried it yet, but recently I was looking for the same
> functionality and ran across JBoss' tattletale tool:
>
> http://www.jboss.org/tattletale http://www.jboss.org/tattletale
>
> "JBoss Tattletale is a tool that can help you get an overview of the
> project
> you are working on or a product that you depend on.
>
> The tool will provide you with reports that can help you
> Identify dependencies between JAR files
> Find missing classes from the classpath
> Spot if a class/package is located in multiple JAR files
> Spot if the same JAR file is located in multiple locations
> With a list of what each JAR file requires and provides
> Verify the SerialVersionUID of a class
> Find similar JAR files that have different version numbers
> Find JAR files without a version number
> Find unused JAR archives
> Identify sealed / signed JAR archives
> Locate a class in a JAR file
> Get the OSGi status of your project
> Remove black listed API usage
> "
>
> --
> View this message in context:
> http://old.nabble.com/Maven-Plugin-to-detect-duplicate-class-files-in-a-e.g.-WAR-tp26658458p26760767.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven Plugin to detect duplicate class files in a e.g. WAR

Posted by lukewpatterson <lu...@gmail.com>.

Mirko Friedenhagen wrote:
> 
> goal to check classpath for duplicate resources/classes
> 

I haven't tried it yet, but recently I was looking for the same
functionality and ran across JBoss' tattletale tool:

http://www.jboss.org/tattletale http://www.jboss.org/tattletale 

"JBoss Tattletale is a tool that can help you get an overview of the project
you are working on or a product that you depend on.
 
The tool will provide you with reports that can help you
Identify dependencies between JAR files
Find missing classes from the classpath
Spot if a class/package is located in multiple JAR files
Spot if the same JAR file is located in multiple locations
With a list of what each JAR file requires and provides
Verify the SerialVersionUID of a class
Find similar JAR files that have different version numbers
Find JAR files without a version number
Find unused JAR archives
Identify sealed / signed JAR archives
Locate a class in a JAR file
Get the OSGi status of your project
Remove black listed API usage
"

-- 
View this message in context: http://old.nabble.com/Maven-Plugin-to-detect-duplicate-class-files-in-a-e.g.-WAR-tp26658458p26760767.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Maven Plugin to detect duplicate class files in a e.g. WAR

Posted by Mirko Friedenhagen <mi...@friedenhagen.de>.
Am 09.12.2009 um 09:10 schrieb Stephen Connolly:
> Should be possible to add a mojo to the maven-dependency-plugin to scan for
> duplicate classes in scope XYZ... that would be the major indicator.
> 
> Of course you'd need include/excludes... and ignores... and failure mode
> control.... probably want a report as well... can you file a JIRA for it...
> if nobody has implemented it by xmas, I'll take a bite

http://jira.codehaus.org/browse/MDEP-245 (goal to check classpath for duplicate resources/classes) seems to be this ticket, right? I really would be happy to see this :-).

Best Regards
Mirko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven Plugin to detect duplicate class files in a e.g. WAR

Posted by Stephen Connolly <st...@gmail.com>.
Should be possible to add a mojo to the maven-dependency-plugin to scan for
duplicate classes in scope XYZ... that would be the major indicator.

Of course you'd need include/excludes... and ignores... and failure mode
control.... probably want a report as well... can you file a JIRA for it...
if nobody has implemented it by xmas, I'll take a bite

-Stephen

2009/12/9 Jörg Schaible <jo...@gmx.de>

> Hi Brian,
>
> Brian Fox wrote at Mittwoch, 9. Dezember 2009 04:44:
>
> > No but when projects move group or artifactIds, they are supposed to
> > create a pom with relocation info in it, then Maven is able to mediate
> > the conflicts.
>
> Apart from relocation, Mirko's idea is quite interesting in case some
> artifacts have been used that collect other packages without knowing.
> Prominent example has been cglib-2.x (containing the ASM 1.5.x stuff that
> broke Hibernate 3.0 using ASM 2.x) or stuff like groovy-all. I know quite
> some more innocent-looking artifacts that may break other dependencies
> because of "class bundling".
>
> Also relocation cannot work if an artifact is splitted (avalon-framework).
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven Plugin to detect duplicate class files in a e.g. WAR

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Brian,

Brian Fox wrote at Mittwoch, 9. Dezember 2009 04:44:

> No but when projects move group or artifactIds, they are supposed to
> create a pom with relocation info in it, then Maven is able to mediate
> the conflicts.

Apart from relocation, Mirko's idea is quite interesting in case some 
artifacts have been used that collect other packages without knowing. 
Prominent example has been cglib-2.x (containing the ASM 1.5.x stuff that 
broke Hibernate 3.0 using ASM 2.x) or stuff like groovy-all. I know quite 
some more innocent-looking artifacts that may break other dependencies 
because of "class bundling".

Also relocation cannot work if an artifact is splitted (avalon-framework).

- Jörg


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


Re: Maven Plugin to detect duplicate class files in a e.g. WAR

Posted by Brian Fox <br...@infinity.nu>.
No but when projects move group or artifactIds, they are supposed to
create a pom with relocation info in it, then Maven is able to mediate
the conflicts.

On Sat, Dec 5, 2009 at 1:29 PM, Mirko Friedenhagen
<mi...@friedenhagen.de> wrote:
> Hello,
>
> sometimes dependencies change their groupId (e.g. commons-io and org.apache.commons or spring vs. org.springframwork). Maven now has no chance(?!) to detect duplicate JARs with different versions during dependency resolution and puts jars with different versions in a war. In the end you are not sure which class will be loaded in a webapp.
>
> Do you know a plugin which will detect such jar/class collisions?
>
> Best Regards
> Mirko
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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