You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Heiko Kopp (JIRA)" <ji...@codehaus.org> on 2012/08/23 08:25:21 UTC

[jira] (MJAR-156) Classpath created in manifest contains timestamp instead of the suffix "-SNAPSHOT"

    [ https://jira.codehaus.org/browse/MJAR-156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=306882#comment-306882 ] 

Heiko Kopp commented on MJAR-156:
---------------------------------

I'm having this problem too and the workaround is simply a workaround. This should be fixed as soon as possible, as it is not obvious why the application is not working and generates ClassNotFoundExceptions. Luckily I've checked the generated MANIFEST.MF.
                
> Classpath created in manifest contains timestamp instead of  the suffix "-SNAPSHOT"
> -----------------------------------------------------------------------------------
>
>                 Key: MJAR-156
>                 URL: https://jira.codehaus.org/browse/MJAR-156
>             Project: Maven 2.x JAR Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3.2, 2.4
>         Environment: Win7 Pro SP1 (64 Bit), JDK 1.6.0_26 (32 Bit)
>            Reporter: Markus KARG
>         Attachments: Sample.zip
>
>
> Sometimes the JAR packager replaces a dependency's "-SNAPSHOT" suffix by a timestamp when calculating a corresponding "Class-Path:"-entry for all dependencies into the MANIFEST.MF file of the packaged JAR. This is problematic, as typically the dependency shipped together with the created JAR will NOT be renamed, but shipped WITH the suffix "-SNAPSHOT". The created JAR will at runtime not find the JAR due to the wrong suffix then ("ClassNotFoundException" will happen for all content in the dependency, obviously). Strange but true, this seem to happen only for SOME JARs and only in SOME particular situations, but I was not able to identify the root causes.
> Attached is a tiny MVN project containing a pom that will produce this behaviour.
> * How to demonstrate:
> - Unpack attached JAR
> - Manually deploy the dependency "webdav-jaxrs-1.2-SNAPSHOT.jar" found in subfolder "install-this-in-repo" into the local repository.
> - mvn clean package
> - "target\sample-1.0.0-SNAPSHOT.jar" contains wrong MANIFEST.MF Class-Path: entry now:
> Class-Path: webdav-jaxrs-1.2-20120621.141509-35.jar jsr311-api-1.1.1.jar
> (Sample output contained in ZIP\target!)
> Obviously "-SNAPSHOT" was replaced by "20120621.141509-35", what induces the problem that the actual dependency is not found, as its file ends still on "-SNAPSHOT" (by intention!). This scenario typically happens when both files end up in an EAR for example.
> * Expected Result:
> - Class-Path: webdav-jaxrs-1.2-SNAPSHOT.jar jsr311-api-1.1.1.jar
> * Actual Result:
> - Class-Path: webdav-jaxrs-1.2-20120621.141509-35.jar jsr311-api-1.1.1.jar
> * Workaround:
> - Provide a static MANIFEST.MF file. Drawback: Changing dependency induces manual corrections to the static file.
> - Fix the entry manually after each build. Drawback: Hard to automate this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira