Re: minijar bombs out when found duplicate classes

2007-03-08 Thread Torsten Curdt


On 08.03.2007, at 08:36, Dan Tran wrote:


My project with minijar:minijars gives this error


Embedded error: duplicate entry: org/xml/sax/SAXException.class
[INFO]
-- 
--

[INFO] For more information, run Maven with the -e switch


is it possible for minijar to ignore it?


Well, I am on it to make it better handled ...but what do you suggest  
should minijar do?


...only one will be active in you classpath.


There are a couple of jars containing the same class in my project.


That's bad :)

cheers
--
Torsten



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: minijar bombs out when found duplicate classes

2007-03-08 Thread Dan Tran

On 3/8/07, Torsten Curdt [EMAIL PROTECTED] wrote:



On 08.03.2007, at 08:36, Dan Tran wrote:

 My project with minijar:minijars gives this error


 Embedded error: duplicate entry: org/xml/sax/SAXException.class
 [INFO]
 --
 --
 [INFO] For more information, run Maven with the -e switch


 is it possible for minijar to ignore it?

Well, I am on it to make it better handled ...but what do you suggest
should minijar do?

...only one will be active in you classpath.




This case, can you display a message showing the bad jars? is it possible
to pickup the first one?
(very much depending on how maven setup the order of classpath )


There are a couple of jars containing the same class in my project.

That's bad :)



Yeah, those are my dependency jars :(

cheers

--
Torsten



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: minijar bombs out when found duplicate classes

2007-03-08 Thread Torsten Curdt

Well, I am on it to make it better handled ...but what do you suggest
should minijar do?

...only one will be active in you classpath.


This case, can you display a message showing the bad jars? is it  
possible

to pickup the first one?
(very much depending on how maven setup the order of classpath )


Someone provided a patch for this - yesterday :) I've now taken this  
to the mojo dev list to discuss how to handle such situations in  
detail. Would be good if you could join us over there.


cheers
--
Torsten




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: minijar bombs out when found duplicate classes

2007-03-08 Thread Wayne Fay

 There are a couple of jars containing the same class in my project.

 That's bad :)

Yeah, those are my dependency jars :(


Dan, can you not use exclusions etc to get rid of the
artifacts/dependencies which are bringing in these duplicated classes?
I've seen some ugly runtime issues resulting from duplicated classes.

Wayne

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: minijar bombs out when found duplicate classes

2007-03-08 Thread Dan Tran

the problem is I dont know which jar files has duplicate classes and I have
49 jars in my dep list ;-)

On 3/8/07, Wayne Fay [EMAIL PROTECTED] wrote:


  There are a couple of jars containing the same class in my project.
 
  That's bad :)

 Yeah, those are my dependency jars :(

Dan, can you not use exclusions etc to get rid of the
artifacts/dependencies which are bringing in these duplicated classes?
I've seen some ugly runtime issues resulting from duplicated classes.

Wayne

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: minijar bombs out when found duplicate classes

2007-03-08 Thread Rod Mclaughlin
I have written a couple of small shell scripts which search Maven for a 
given class, eg.
mvngrep.sh ClassVisitor will find all those jars containing class 
org.objectweb.asm.ClassVisitor.
The next step is to write a java program which searches for an example 
of the class which contains a particular method signature, and put that 
jar first in the classpath. Some of our code depends on code that calls the
|*visit 
http://asm.objectweb.org/current/doc/javadoc/user/org/objectweb/asm/ClassVisitor.html#visit%28int,%20int,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%5B%5D%29*(int, 
int, String 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true, 
String 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true, 
String 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true, 
String 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true[])| 
method of ClassVisitor as opposed to the
|*visit 
http://asm.objectweb.org/current/doc/javadoc/user/org/objectweb/asm/ClassVisitor.html#visit%28int,%20int,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%5B%5D%29*(int, 
int, String 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true, 
String 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true, 
String 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true[], 
String 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true)| 
method. But if java or javac finds the old version first, it will try to 
use it, and won't find the method it needs. The scripts are as follows 
(if you are using Windows, run them in a CYGWIN shell). The first script 
calls the second:

--- mvngrep.sh:
#!/bin/sh
if [  == $1 ] ; then
   echo Usage: $0 class/package: searches Maven's downloaded jars
   exit 1
fi
mkdir ~/tmp 2/dev/null
mkdir ~/tmp/allmvnjars/ 2/dev/null
rm -f ~/tmp/allmvnjars/*jar
find ~/.m2 -name *jar -exec cp -f {} ~/tmp/allmvnjars \;
wargrep.sh ~/tmp/allmvnjars $1
--- wargrep.sh:
#!/bin/sh
if [  == $1 ] || [  == $2 ] ; then
   echo Usage: $0 folder class/package: searches contents of wars 
and jars

   exit 1
fi

JARS=`ls $1/*.?ar`
for WAR in $JARS ; do
RESULT=`jar tvf $WAR | grep $2`
if [  != $RESULT ] ; then
   echo $WAR
#   echo $RESULT
fi
done





Dan Tran wrote:
the problem is I dont know which jar files has duplicate classes and I 
have

49 jars in my dep list ;-)

On 3/8/07, Wayne Fay [EMAIL PROTECTED] wrote:


  There are a couple of jars containing the same class in my project.
 
  That's bad :)

 Yeah, those are my dependency jars :(

Dan, can you not use exclusions etc to get rid of the
artifacts/dependencies which are bringing in these duplicated classes?
I've seen some ugly runtime issues resulting from duplicated classes.

Wayne

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: minijar bombs out when found duplicate classes

2007-03-08 Thread Torsten Curdt


On 08.03.2007, at 23:02, Rod Mclaughlin wrote:

I have written a couple of small shell scripts which search Maven  
for a given class, eg.
mvngrep.sh ClassVisitor will find all those jars containing class  
org.objectweb.asm.ClassVisitor.


Actually once I had the idea to index the whole maven repo and  
provide a service to search for methods signature, classes etc.  
Writing IDE plugins would be the next step. *shrug*


...nice little project - just wasn't sure whether that would be worth  
the effort. Would that be useful?


cheers
--
Torsten



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]