Hi Pants-devel,
I’m getting closer to getting a working binary out of my pants build. I’ve been able to compile with ‘./pants goal bundle ‘ and I get a directory full of stuff under dist/-bundle/ just like I expected.
I’m getting many duplicate classes listed in the output, like:
Duplicate classes and/or resources detected in artifacts: (u'log4j-apache-log4j-extras-1.2.17.jar', u'log4j-log4j-1.2.17.jar', u'org.slf4j-log4j-over-slf4j-1.7.4.jar')
… There are 37 different messages like this …
As a part of the conversion from Maven, I took all of the stantzas in our pom.xml files and turned them into jar().exclude() calls in out Pants BUILD files, but either I missed some or that was not sufficient.
Unfortunately, this isn’t just annoying, it keeps my app from running:
java -jar ./dist/foo-bundle/foo.jar
SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.log4j.Logger.getLogger(Logger.java:40)
at org.apache.log4j.Logger.getLogger(Logger.java:48)
at ...
Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
at org.apache.log4j.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:50)
... 5 more
In trying to diagnose this, I came across the goad depmap:
$ ./pants goal depmap <name> > /tmp/depmap.out
$ grep log4j-over-slf4j /tmp/depmap.out
<nothing>
When I look at depmap.out I see a very nice dependency tree, but I what I don’t see is the transient dependencies that ivy is pulling in, and these are the ones I need to work on filtering out. Do you have any suggestions on how to go about finding these? I was thinking it would be nice to have a flag to add to goal depmap that would show ivy deps embedded with the rest of the depmap.
Also, maybe related, there is some output that I don’t understand:
Missing BUILD dependency testing/src/main/java:lib -> 3rdparty:com.sun.jersey.jersey-core because:
testing/src/main/java/com/squareup/testing/integration/ProtoJsonHttpClient.java uses .pants.d/ivy/jars/com.sun.jersey/jersey-core/jars/jersey-core-1.18.1.jar
testing/src/main/java/com/squareup/testing/http/MockHttpHeaders.java uses .pants.d/ivy/jars/com.sun.jersey/jersey-core/jars/jersey-core-1.18.1.jar
Missing BUILD dependency common/card/src/main/java:lib -> .pants.d/ivy/jars/com.squareup.common/common-foo/jars/common-foo-d6ed88d6-a279fe02.jar
... about 306 of these ...
Thanks!
-Eric.
Hi Pants-devel,
I’m getting closer to getting a working binary out of my pants build. I’ve been able to compile with ‘./pants goal bundle ‘ and I get a directory full of stuff under dist/-bundle/ just like I expected.
I’m getting many duplicate classes listed in the output, like:
Duplicate classes and/or resources detected in artifacts: (u'log4j-apache-log4j-extras-1.2.17.jar', u'log4j-log4j-1.2.17.jar', u'org.slf4j-log4j-over-slf4j-1.7.4.jar')… There are 37 different messages like this …
As a part of the conversion from Maven, I took all of the stantzas in our pom.xml files and turned them into jar().exclude() calls in out Pants BUILD files, but either I missed some or that was not sufficient.
Unfortunately, this isn’t just annoying, it keeps my app from running:java -jar ./dist/foo-bundle/foo.jar SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details. Exception in thread "main" java.lang.ExceptionInInitializerError at org.apache.log4j.Logger.getLogger(Logger.java:40) at org.apache.log4j.Logger.getLogger(Logger.java:48) at ... Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details. at org.apache.log4j.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:50) ... 5 moreIn trying to diagnose this, I came across the goad depmap:
$ ./pants goal depmap <name> > /tmp/depmap.out $ grep log4j-over-slf4j /tmp/depmap.out <nothing>When I look at depmap.out I see a very nice dependency tree, but I what I don’t see is the transient dependencies that ivy is pulling in, and these are the ones I need to work on filtering out. Do you have any suggestions on how to go about finding these? I was thinking it would be nice to have a flag to add to goal depmap that would show ivy deps embedded with the rest of the depmap.
Also, maybe related, there is some output that I don’t understand:
Missing BUILD dependency testing/src/main/java:lib -> 3rdparty:com.sun.jersey.jersey-core because: testing/src/main/java/com/squareup/testing/integration/ProtoJsonHttpClient.java uses .pants.d/ivy/jars/com.sun.jersey/jersey-core/jars/jersey-core-1.18.1.jar testing/src/main/java/com/squareup/testing/http/MockHttpHeaders.java uses .pants.d/ivy/jars/com.sun.jersey/jersey-core/jars/jersey-core-1.18.1.jar Missing BUILD dependency common/card/src/main/java:lib -> .pants.d/ivy/jars/com.squareup.common/common-foo/jars/common-foo-d6ed88d6-a279fe02.jar ... about 306 of these ...
Thanks!
-Eric.
I am pretty sure I did not leave out 300 dependencies, bit I'll have to dig deeper. I used our Maven pom.xml files to determine them and generate the BUILD files from them at the moment is there some reason that I would have to be more specific with Pants?
For better or for worse, it is picking up log4j-over-slf4j which we do not want at all. It has some classes that are also in one of the log4j jar files.
Is there a way to turn off this feature as an experiment?
Missing BUILD dependency webservice/session/src/main/java:lib -> .pants.d/ivy/jars/com.squareup/crypto/jars/crypto-3f97f4a2-a279fe02.jar
Missing BUILD dependency webservice/client/src/main/java:lib -> .pants.d/ivy/jars/com.squareup/common/jars/common-c807010a-ec1445af.jar
...