You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kevin Burton <bu...@spinn3r.com> on 2015/04/05 19:57:07 UTC

Easy way to tell if I have .class file conflicts between two jars?

Im looking for a somewhat easy way to tell if a directory of .jar files
contains class reference which conflict.

For example,org/xml/sax/XMLReader.class from two incompatible versions.

I wrote a simple command that does a find and then a "jar tf" to list the
contents, then I sort by the filename, but this creates false positives in
the case where the files are actually the same .class file version.

I think I could just use SHA1 to detect this … if the SHA1 is identical I
can just ignore it.

Of course a WAY better way to do this would be some sort of maven plugin
that looked at all dependencies and generated errors/warnings if you add a
dependency with class conflicts.  That would be sweet.

-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Re: Easy way to tell if I have .class file conflicts between two jars?

Posted by Steven Schlansker <st...@gmail.com>.
I've been very happy with: https://github.com/basepom/duplicate-finder-maven-plugin

On Apr 5, 2015, at 11:59 AM, Kevin Burton <bu...@spinn3r.com> wrote:

> Looks like it works but it’s a little too strict. I just manually resolved
> some of the dependencies for one of my projects and it’s complaining about
> conflicts even though the effective class path doesn’t have those class
> conflicts.  hm.
> 
> On Sun, Apr 5, 2015 at 11:11 AM, Robert Scholte <rf...@apache.org>
> wrote:
> 
>> Hi,
>> 
>> take a look at this enforcer rule:
>> http://mojo.codehaus.org/extra-enforcer-rules/banDuplicateClasses.html
>> 
>> Robert
>> 
>> Op Sun, 05 Apr 2015 19:57:07 +0200 schreef Kevin Burton <
>> burton@spinn3r.com>:
>> 
>> Im looking for a somewhat easy way to tell if a directory of .jar files
>>> contains class reference which conflict.
>>> 
>>> For example,org/xml/sax/XMLReader.class from two incompatible versions.
>>> 
>>> I wrote a simple command that does a find and then a "jar tf" to list the
>>> contents, then I sort by the filename, but this creates false positives in
>>> the case where the files are actually the same .class file version.
>>> 
>>> I think I could just use SHA1 to detect this … if the SHA1 is identical I
>>> can just ignore it.
>>> 
>>> Of course a WAY better way to do this would be some sort of maven plugin
>>> that looked at all dependencies and generated errors/warnings if you add a
>>> dependency with class conflicts.  That would be sweet.
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
> 
> 
> -- 
> 
> Founder/CEO Spinn3r.com
> Location: *San Francisco, CA*
> blog: http://burtonator.wordpress.com
> … or check out my Google+ profile
> <https://plus.google.com/102718274791889610666/posts>
> <http://spinn3r.com>


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


Re: Easy way to tell if I have .class file conflicts between two jars?

Posted by Kevin Burton <bu...@spinn3r.com>.
Looks like it works but it’s a little too strict. I just manually resolved
some of the dependencies for one of my projects and it’s complaining about
conflicts even though the effective class path doesn’t have those class
conflicts.  hm.

On Sun, Apr 5, 2015 at 11:11 AM, Robert Scholte <rf...@apache.org>
wrote:

> Hi,
>
> take a look at this enforcer rule:
> http://mojo.codehaus.org/extra-enforcer-rules/banDuplicateClasses.html
>
> Robert
>
> Op Sun, 05 Apr 2015 19:57:07 +0200 schreef Kevin Burton <
> burton@spinn3r.com>:
>
>  Im looking for a somewhat easy way to tell if a directory of .jar files
>> contains class reference which conflict.
>>
>> For example,org/xml/sax/XMLReader.class from two incompatible versions.
>>
>> I wrote a simple command that does a find and then a "jar tf" to list the
>> contents, then I sort by the filename, but this creates false positives in
>> the case where the files are actually the same .class file version.
>>
>> I think I could just use SHA1 to detect this … if the SHA1 is identical I
>> can just ignore it.
>>
>> Of course a WAY better way to do this would be some sort of maven plugin
>> that looked at all dependencies and generated errors/warnings if you add a
>> dependency with class conflicts.  That would be sweet.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Re: Easy way to tell if I have .class file conflicts between two jars?

Posted by Robert Scholte <rf...@apache.org>.
Hi,

take a look at this enforcer rule:
http://mojo.codehaus.org/extra-enforcer-rules/banDuplicateClasses.html

Robert

Op Sun, 05 Apr 2015 19:57:07 +0200 schreef Kevin Burton  
<bu...@spinn3r.com>:

> Im looking for a somewhat easy way to tell if a directory of .jar files
> contains class reference which conflict.
>
> For example,org/xml/sax/XMLReader.class from two incompatible versions.
>
> I wrote a simple command that does a find and then a "jar tf" to list the
> contents, then I sort by the filename, but this creates false positives  
> in
> the case where the files are actually the same .class file version.
>
> I think I could just use SHA1 to detect this … if the SHA1 is identical I
> can just ignore it.
>
> Of course a WAY better way to do this would be some sort of maven plugin
> that looked at all dependencies and generated errors/warnings if you add  
> a
> dependency with class conflicts.  That would be sweet.

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