Incorrect assembly created with Maven 3.0.3
Hi, I have a strange problem when building an assembly with Maven 3.0.3, and I don't know where to debug...: My project uses a combination of the appassembler mojo (1.1.1) and assembly plugin (2.2.1), both attached to the "package" phase, to create a tar.gz archive that basically has the following structure: my-prg/ my-prg/bin/ my-prg/bin/my-prg.cmd my-prg/bin/my-prg.sh my-prg/bin/local-log4j.xml my-prg/bin/log4j.dtd my-prg/lib/ (lots of Jar files) my-prg/log/ my-prg/log/readme.txt An end user unzips the archive and starts the program by one of the shell scripts (.cmd for Windows, .sh for Unix). Today I released a new version of my program, and just before informing my colleages that it's available I tested it by myself from a Windows box and finally got ClassNotFoundException because of a missing dependency Jar in the lib folder; more precisely xalan:serializer:2.7.1 Looking into the tar.gz archive I couldn't see that jar although it is used as a transitive compile-time dependency somewhere in the dependency tree of my program. The latter is verifiable by for example mvn dependency:tree: thorsten$ mvn dependency:tree [INFO] Scanning for projects... [INFO] [INFO] [INFO] Building my-prg 0.4.6 [INFO] [INFO] [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ my-prg --- [INFO] prg:my-prg:jar:0.4.6 ... [INFO] | +- lib:v-base:jar:1.8:compile [INFO] | | +- org.apache.axis:axis-saaj:jar:1.4:compile [INFO] | | +- commons-logging:commons-logging:jar:1.1.1:compile (version managed from 1.0.4) [INFO] | | +- commons-validator:commons-validator:jar:1.0.2:compile [INFO] | | | +- commons-beanutils:commons-beanutils:jar:1.5:compile [INFO] | | | \- commons-collections:commons-collections:jar:2.1:compile [INFO] | | +- commons-digester:commons-digester:jar:1.8:compile [INFO] | | +- oro:oro:jar:2.0.8:compile [INFO] | | +- commons-discovery:commons-discovery:jar:0.4:compile [INFO] | | +- wsdl4j:wsdl4j:jar:1.6.1:compile [INFO] | | +- xerces:xercesImpl:jar:2.9.1:compile [INFO] | | \- xalan:xalan:jar:2.7.1:compile [INFO] | | \- xalan:serializer:jar:2.7.1:compile ... For curiosity I did a "mvn package" on my project by using Maven 2.2.1 and exactly the same code base. Comparing the resulting archives shows an interesting phenomenon: * The archive created by Maven 3.0.3 contains a dependency to org.apache.xmlgraphics:batik-js:1.7 (not shown by dependency:tree) and is missing one to xalan:serializer:jar * The archive created by Maven 2.2.1 contains only those dependencies that are listed in the dependency tree with scope "compile". >From my pom.xml: (...) src/main/resources ../my-prg org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-deploy-plugin 2.5 org.apache.maven.plugins maven-javadoc-plugin 2.8 org.apache.maven.plugins maven-release-plugin 2.1 org.apache.maven.plugins maven-resources-plugin 2.5 org.apache.maven.plugins maven-scm-plugin 1.5 cvs_native install org.apache.maven.plugins maven-source-plugin 2.1.2 org.codehaus.mojo appassembler-maven-plugin 1.1.1 attach-appassembler package assemble
Re: Incorrect assembly created with Maven 3.0.3
> finally got ClassNotFoundException because of a missing dependency Jar in > the lib folder; more precisely xalan:serializer:2.7.1 > > PS: I tested it with Maven 3.0.3 using Java 1.6.0_24, first on Solaris 11 > Express and then on Mac OS X 10.6.7. Xalan and Xerces are special since they have been absorbed into the JVM as of 1.4. In 1.5 they were basically shaded so now they are under com.sun.* instead of directly under org.apache.* which was causing problems. What class specifically is giving you the CNFE? Are you building and then running your code with the same version etc of the JVM? This may be a situation where a jdk-specific profile is kicking in and including (or not) a dependency during your build... or something else of course. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Incorrect assembly created with Maven 3.0.3
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, >> finally got ClassNotFoundException because of a missing dependency Jar in >> the lib folder; more precisely xalan:serializer:2.7.1 >> >> PS: I tested it with Maven 3.0.3 using Java 1.6.0_24, first on Solaris 11 >> Express and then on Mac OS X 10.6.7. > > Xalan and Xerces are special since they have been absorbed into the > JVM as of 1.4. In 1.5 they were basically shaded so now they are under > com.sun.* instead of directly under org.apache.* which was causing > problems. Xalan and Xerces are actually included because the versions in 1.4 / 1.5 are older than those available at apache.org. As far as I know they are needed by some legacy code for (de-)serialization of objects. I don't know if it is feasible to replace that code in short or mid term to make (better) usage of the capabilities provided directly by Java 6. > What class specifically is giving you the CNFE? I'm at home so I can't tell what class was causing this error. I'll see Monday when I'm at work, but I guess it was something like org/apache/xml/serializer/Serializer > Are you building and > then running your code with the same version etc of the JVM? Yes. But what puzzles me is that the archives created by Maven 2.2.1 and Maven 3.0.3 are different, and I don't see a reason why... > This may > be a situation where a jdk-specific profile is kicking in and > including (or not) a dependency during your build... or something else > of course. I don't use any profile, and the in-house dependencies I'm using also don't make usage of profiles. Thorsten -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) iQIcBAEBAgAGBQJNzlPbAAoJEFpUu7h4Il4IQ+cP/0Hg0YYDc4Uu3eVTGMqPYWd9 GeKmiUNw/mZHcR56aAUG1xgCjxfvtX1Ub3SGGNn8TKF4fNMboQv+YE41Ze8ALVC7 uX1TBu8LeWO3gq3qP7McsTxZ/+aVjYqv3RigEWEs/gOv9Z+oei3hYl8/c+9sr/sq c1TU+A6dZqjsBeEnp0/lNoGvPV6fe/Dg+GuO9XVBZsPf7f8trL16vUPmAuyFaEoy awN0+ZneWbMi3Ye/bTw6cCqePXIJW9UasP4uN/+QuEHokNbLixyXjd5AQ9dQhOKm Ov3Nf2xaFa99XGi8lIqiX0ds548hC/Ub8B04/5yyv2bKcyxKcuoIa9oxYb1LlyBB PV8VOQuVhz++mjdYVe7g70NklXI4uLo7kCxnOsfd8XgFnoxUjjj646AKpbiOwzHH ACn1DVN2ijBDfmGmfracJo7nwkdbuEKGNIqivTg87S3EzZNATErTbSlBM4Y1Fj7+ tJb0J7SUcQBxWt4jiJBqOva0/S7l+tveQGezpIrdsv4/OglTy3vLvGNL9+J+GQlm nlBRxsFcCVJkmhViBhNjuFAx1M6+g7pEjjxETl7OaZKtWJ0lDcoxUxQ/POfC5RKS grhykOtrW1xU4qAJCzI4OJ72Qv9z9p/ORwGy5DAFaGAvTUK8ClzzZJRwznkilcBo kV7bX6nN+bDhTzp//8P9 =Yfmg -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Incorrect assembly created with Maven 3.0.3
Thorsten Heit wrote: > > ...snip ... > > But what puzzles me is that the archives created by Maven 2.2.1 and Maven > 3.0.3 are different, and I don't see a reason why... > > ...snip... > Hi there, Did you ever get anywhere with this? I'm seeing the same problem: Maven 3.0.3 adds batik-js-1.7.jar and omits serializer-2.7.1.jar. Though I am not positive, I believe this is the cause of an exception I see at runtime, the stack trace of which starts like this: java.lang.IllegalAccessError: org/apache/xml/serializer/ExtendedContentHandler at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1233) ... Thanks! -- View this message in context: http://maven.40175.n5.nabble.com/Incorrect-assembly-created-with-Maven-3-0-3-tp4393328p4811951.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Incorrect assembly created with Maven 3.0.3
Just a wild guess, do you have a dependencyManagament handling these artifacts where the scope is defined? I've seen different behavior between Maven 2.x and 3.0.x due to this (MJBOSSPACK-40 [1]). /Anders [1] http://jira.codehaus.org/browse/MJBOSSPACK-40 On Fri, Sep 16, 2011 at 22:43, WhiteMarlin wrote: > > Thorsten Heit wrote: >> >> ...snip ... >> >> But what puzzles me is that the archives created by Maven 2.2.1 and Maven >> 3.0.3 are different, and I don't see a reason why... >> >> ...snip... >> > > Hi there, > > Did you ever get anywhere with this? I'm seeing the same problem: Maven > 3.0.3 adds batik-js-1.7.jar and omits serializer-2.7.1.jar. > > Though I am not positive, I believe this is the cause of an exception I see > at runtime, the stack trace of which starts like this: > > java.lang.IllegalAccessError: > org/apache/xml/serializer/ExtendedContentHandler > at > org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1233) > ... > > Thanks! > > > -- > View this message in context: > http://maven.40175.n5.nabble.com/Incorrect-assembly-created-with-Maven-3-0-3-tp4393328p4811951.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Antwort: Re: Incorrect assembly created with Maven 3.0.3
Hi, > Thorsten Heit wrote: > > > > ...snip ... > > > > But what puzzles me is that the archives created by Maven 2.2.1 and Maven > > 3.0.3 are different, and I don't see a reason why... > > > > ...snip... > > > > Hi there, > > Did you ever get anywhere with this? I'm seeing the same problem: Maven > 3.0.3 adds batik-js-1.7.jar and omits serializer-2.7.1.jar. > > Though I am not positive, I believe this is the cause of an exception I see > at runtime, the stack trace of which starts like this: > > java.lang.IllegalAccessError: > org/apache/xml/serializer/ExtendedContentHandler >at > org.apache.xalan.transformer.TransformerImpl.createSerializationHandler > (TransformerImpl.java:1233) > ... I get a ClassNotFoundException at runtime. I don't know exactly which class, but it was one from the serializer jar... Unfortunately the only solution I have so far is to directly add a dependency to the serializer jar in the pom although no class in the project uses it - it is used transitively by xerces or xalan I guess... Regards Thorsten
Re: Re: Incorrect assembly created with Maven 3.0.3
Hi, > Just a wild guess, do you have a dependencyManagament handling these > artifacts where the scope is defined? I've seen different behavior > between Maven 2.x and 3.0.x due to this (MJBOSSPACK-40 [1]). No, I haven't used dependency management. I simply referenced xerces and/or xalan (don't remember it exactly because I changed the project in the meantime...) Regards Thorsten