You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by it...@daimler.com on 2012/08/22 15:17:30 UTC

Manifest of WAR contains wrong references to SNAPSHOT-versions of EAR-based libaries

Hello,

I've come across a rather sever problem in our environment. We create 
EAR-projects that contain WAR-modules and use the old-fashioned way to 
handle skinny WAR-files by denoting the maven-war-plugin to exclude all 
jar-files and rather put them in the EAR-lib-directory. This is done by 
the following plugin configurations for EAR and WAR:

EAR-pom.xml

                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <configuration>
                    <version>6</version>
                    <defaultLibBundleDir>lib/</defaultLibBundleDir>
                    <generateApplicationXml>true</generateApplicationXml>
                    <archive>
                        <manifestEntries>
                            <Implementation-Title>DAAS BE</
Implementation-Title>
                            <Implementation-Version>${project.version} 
${timestamp}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                    <security>
                        <security-role id="CONFIG">
                            <role-name>CONFIG</role-name>
                        </security-role>
                        <security-role id="WEBSERVICE_GET">
                            <role-name>WEBSERVICE_GET</role-name>
                        </security-role>
                        <security-role id="WEBSERVICE_SET">
                            <role-name>WEBSERVICE_SET</role-name>
                        </security-role>
                    </security>
                    <modules>
                        <webModule>
                            <groupId>daas-backend</groupId>
                            <artifactId>daas-backend-war</artifactId>
                            <contextRoot>Daas</contextRoot>
                            <bundleFileName>daas-backend-war.war</
bundleFileName>
                        </webModule>
                        <ejbModule>
                            <groupId>daas-backend</groupId>
                            <artifactId>daas-backend-system</artifactId>
                            <bundleFileName>daas-backend-system.jar</
bundleFileName>
                        </ejbModule>
                    </modules>
                </configuration>
            </plugin>

WAR-pom.xml:

                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration> 
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <packagingExcludes>WEB-INF/lib/*.jar</
packagingExcludes> 
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>     
                        </manifest> 
                    </archive> 
                </configuration>
            </plugin>

However, in case a SNAPSHOT-version of a dependency is added to both, the 
EAR and the WAR, the corresponding MANIFEST-ClassPath-Entry of the 
dependency is created wrong as shown below:

Generated ClassPath:

Class-Path: daas-backend-system.jar lib/websphere-admin-client-2012.2.
 0-SNAPSHOT.jar lib/logging-5.0.0.jar lib/util-5.0.0.jar lib/jaxb2-bas
 ics-runtime-0.6.3.jar lib/websphere-admin-client-2012.2.0-20120822.03
 1057-2.jar lib/poi-3.7.jar lib/commons-beanutils-1.8.3.jar lib/jbpm-j
 pdl-4.5-20120709.122214-1.jar lib/jbpm-api-4.5-20120709.122204-2.jar 
 lib/jbpm-pvm-4.5-20120709.122211-1.jar lib/jbpm-log-4.5-20120709.1222
 06-2.jar lib/hibernate-core-3.6.7.Final.jar lib/antlr-2.7.6.jar lib/c
 ommons-collections-3.1.jar lib/dom4j-1.6.1.jar lib/hibernate-commons-
 annotations-3.2.0.Final.jar lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
  lib/slf4j-api-1.6.1.jar lib/slf4j-jdk14-1.6.2.jar lib/commons-lang-2
 .6.jar lib/soap-2.3.1.jar lib/guava-11.0.1.jar lib/jsr305-1.3.9.jar

Here the snapshots have been created as:

lib/websphere-admin-client-2012.2.0-20120822.031057-2.jar
lib/jbpm-jpdl-4.5-20120709.122214-1.jar 
lib/jbpm-api-4.5-20120709.122204-2.jar 
lib/jbpm-pvm-4.5-20120709.122211-1.jar
lib/jbpm-log-4.5-20120709.122206-2.jar 

But the EAR-lib directory contains them as

lib/websphere-admin-client-SNAPSHOT.jar
lib/jbpm-jpdl-4.5-SNAPSHOT.jar
lib/jbpm-api-4.5-SNAPSHOT.jar
lib/jbpm-pvm-4.5-SNAPSHOT.jar
lib/jbpm-log-4.5-SNAPSHOT.jar

The only solution that I could think of to this is to manually add the 
wrong dependencies by adding the following to the maven-war-plugin 
configuration:

                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration> 
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <packagingExcludes>WEB-INF/lib/*.jar</
packagingExcludes> 
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>     
                        </manifest>
                        <manifestEntries>
                            <Class-Path>daas-backend-system.jar 
lib/websphere-admin-client-2012.2.0-SNAPSHOT.jar 
lib/jbpm-api-4.5-SNAPSHOT.jar lib/jbpm-log-4.5-SNAPSHOT.jar 
lib/jbpm-jpdl-4.5-SNAPSHOT.jar lib/jbpm-pvm-4.5-SNAPSHOT.jar</Class-Path>
                        </manifestEntries>
                    </archive> 
                </configuration>
            </plugin>

What did I do wrong here? I cannot imagine this happend before. I'm 
clueless on how to handle this any better.

Please help!

Thank you very much.

Best regards,

Heiko

If you are not the intended addressee, please inform us immediately that you have received this e-mail in error, and delete it. We thank you for your cooperation.  

Re: Manifest of WAR contains wrong references to SNAPSHOT-versions of EAR-based libaries

Posted by Wayne Fay <wa...@gmail.com>.
Just resending the part of Michael's email/post that was eaten by
Nabble and not forwarded...

You just have to add the following entry to your manifest
configuration bundled with the maven war plguin:

  <manifest>
    <addClasspath>true</addClasspath>
    <useUniqueVersions>false</useUniqueVersions>
  </manifest>


Wayne

On Fri, Oct 5, 2012 at 5:03 AM, Michael Feichtegger
<mi...@feichtegger.at> wrote:
> Probable you know already the reason why there is a timestamp and a
> buildnumber being attached to your Manifest classpath but for all those who
> will have the same issue I will provide a solution:
>
> You just have to add the following entry to your manifest configuration
> bundled with the maven war plguin:
>
>
>
> Setting the "useUniqueVersions" flag to "false", which is "true" by default,
> instructs maven to use the SNAPSHOT-jar in the manifest classpath.
>
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Manifest-of-WAR-contains-wrong-references-to-SNAPSHOT-versions-of-EAR-based-libaries-tp5717908p5724922.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
>

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


Re: Manifest of WAR contains wrong references to SNAPSHOT-versions of EAR-based libaries

Posted by Michael Feichtegger <mi...@feichtegger.at>.
Probable you know already the reason why there is a timestamp and a
buildnumber being attached to your Manifest classpath but for all those who
will have the same issue I will provide a solution:

You just have to add the following entry to your manifest configuration
bundled with the maven war plguin:



Setting the "useUniqueVersions" flag to "false", which is "true" by default,
instructs maven to use the SNAPSHOT-jar in the manifest classpath.



--
View this message in context: http://maven.40175.n5.nabble.com/Manifest-of-WAR-contains-wrong-references-to-SNAPSHOT-versions-of-EAR-based-libaries-tp5717908p5724922.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: Manifest of WAR contains wrong references to SNAPSHOT-versions of EAR-based libaries

Posted by Markus KARG <ma...@headcrashing.eu>.
This is a known bug. See:

http://jira.codehaus.org/browse/MJAR-156

http://jira.codehaus.org/browse/MACR-4

Please comment and vote these bugs that you also suffer from this problem
and want to see it fixed.

> -----Original Message-----
> From: it-media.kopp@daimler.com [mailto:it-media.kopp@daimler.com]
> Sent: Mittwoch, 22. August 2012 15:18
> To: users@maven.apache.org
> Subject: Manifest of WAR contains wrong references to SNAPSHOT-versions
> of EAR-based libaries
> 
> Hello,
> 
> I've come across a rather sever problem in our environment. We create
> EAR-projects that contain WAR-modules and use the old-fashioned way to
> handle skinny WAR-files by denoting the maven-war-plugin to exclude all
> jar-files and rather put them in the EAR-lib-directory. This is done by
> the following plugin configurations for EAR and WAR:
> 
> EAR-pom.xml
> 
>                 <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-ear-plugin</artifactId>
>                 <configuration>
>                     <version>6</version>
>                     <defaultLibBundleDir>lib/</defaultLibBundleDir>
> 
> <generateApplicationXml>true</generateApplicationXml>
>                     <archive>
>                         <manifestEntries>
>                             <Implementation-Title>DAAS BE</
> Implementation-Title>
>                             <Implementation-Version>${project.version}
> ${timestamp}</Implementation-Version>
>                         </manifestEntries>
>                     </archive>
>                     <security>
>                         <security-role id="CONFIG">
>                             <role-name>CONFIG</role-name>
>                         </security-role>
>                         <security-role id="WEBSERVICE_GET">
>                             <role-name>WEBSERVICE_GET</role-name>
>                         </security-role>
>                         <security-role id="WEBSERVICE_SET">
>                             <role-name>WEBSERVICE_SET</role-name>
>                         </security-role>
>                     </security>
>                     <modules>
>                         <webModule>
>                             <groupId>daas-backend</groupId>
>                             <artifactId>daas-backend-war</artifactId>
>                             <contextRoot>Daas</contextRoot>
>                             <bundleFileName>daas-backend-war.war</
> bundleFileName>
>                         </webModule>
>                         <ejbModule>
>                             <groupId>daas-backend</groupId>
>                             <artifactId>daas-backend-
> system</artifactId>
>                             <bundleFileName>daas-backend-system.jar</
> bundleFileName>
>                         </ejbModule>
>                     </modules>
>                 </configuration>
>             </plugin>
> 
> WAR-pom.xml:
> 
>                 <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-war-plugin</artifactId>
>                 <configuration>
>                     <failOnMissingWebXml>false</failOnMissingWebXml>
>                     <packagingExcludes>WEB-INF/lib/*.jar</
> packagingExcludes>
>                     <archive>
>                         <manifest>
>                             <addClasspath>true</addClasspath>
>                             <classpathPrefix>lib/</classpathPrefix>
>                         </manifest>
>                     </archive>
>                 </configuration>
>             </plugin>
> 
> However, in case a SNAPSHOT-version of a dependency is added to both,
> the EAR and the WAR, the corresponding MANIFEST-ClassPath-Entry of the
> dependency is created wrong as shown below:
> 
> Generated ClassPath:
> 
> Class-Path: daas-backend-system.jar lib/websphere-admin-client-2012.2.
>  0-SNAPSHOT.jar lib/logging-5.0.0.jar lib/util-5.0.0.jar lib/jaxb2-bas
> ics-runtime-0.6.3.jar lib/websphere-admin-client-2012.2.0-20120822.03
>  1057-2.jar lib/poi-3.7.jar lib/commons-beanutils-1.8.3.jar lib/jbpm-j
> pdl-4.5-20120709.122214-1.jar lib/jbpm-api-4.5-20120709.122204-2.jar
>  lib/jbpm-pvm-4.5-20120709.122211-1.jar lib/jbpm-log-4.5-20120709.1222
> 06-2.jar lib/hibernate-core-3.6.7.Final.jar lib/antlr-2.7.6.jar lib/c
> ommons-collections-3.1.jar lib/dom4j-1.6.1.jar lib/hibernate-commons-
> annotations-3.2.0.Final.jar lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
>   lib/slf4j-api-1.6.1.jar lib/slf4j-jdk14-1.6.2.jar lib/commons-lang-2
> .6.jar lib/soap-2.3.1.jar lib/guava-11.0.1.jar lib/jsr305-1.3.9.jar
> 
> Here the snapshots have been created as:
> 
> lib/websphere-admin-client-2012.2.0-20120822.031057-2.jar
> lib/jbpm-jpdl-4.5-20120709.122214-1.jar
> lib/jbpm-api-4.5-20120709.122204-2.jar
> lib/jbpm-pvm-4.5-20120709.122211-1.jar
> lib/jbpm-log-4.5-20120709.122206-2.jar
> 
> But the EAR-lib directory contains them as
> 
> lib/websphere-admin-client-SNAPSHOT.jar
> lib/jbpm-jpdl-4.5-SNAPSHOT.jar
> lib/jbpm-api-4.5-SNAPSHOT.jar
> lib/jbpm-pvm-4.5-SNAPSHOT.jar
> lib/jbpm-log-4.5-SNAPSHOT.jar
> 
> The only solution that I could think of to this is to manually add the
> wrong dependencies by adding the following to the maven-war-plugin
> configuration:
> 
>                 <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-war-plugin</artifactId>
>                 <configuration>
>                     <failOnMissingWebXml>false</failOnMissingWebXml>
>                     <packagingExcludes>WEB-INF/lib/*.jar</
> packagingExcludes>
>                     <archive>
>                         <manifest>
>                             <addClasspath>true</addClasspath>
>                             <classpathPrefix>lib/</classpathPrefix>
>                         </manifest>
>                         <manifestEntries>
>                             <Class-Path>daas-backend-system.jar
> lib/websphere-admin-client-2012.2.0-SNAPSHOT.jar
> lib/jbpm-api-4.5-SNAPSHOT.jar lib/jbpm-log-4.5-SNAPSHOT.jar lib/jbpm-
> jpdl-4.5-SNAPSHOT.jar lib/jbpm-pvm-4.5-SNAPSHOT.jar</Class-Path>
>                         </manifestEntries>
>                     </archive>
>                 </configuration>
>             </plugin>
> 
> What did I do wrong here? I cannot imagine this happend before. I'm
> clueless on how to handle this any better.
> 
> Please help!
> 
> Thank you very much.
> 
> Best regards,
> 
> Heiko
> 
> If you are not the intended addressee, please inform us immediately
> that you have received this e-mail in error, and delete it. We thank
> you for your cooperation.


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