Uploaded image for project: 'Maven JAR Plugin'
  1. Maven JAR Plugin
  2. MJAR-156

Classpath created in manifest contains timestamp instead of the suffix "-SNAPSHOT"

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Auto Closed
    • 2.3.2, 2.4
    • None
    • None
    • None
    • Win7 Pro SP1 (64 Bit), JDK 1.6.0_26 (32 Bit)

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            mkarg Markus Karg
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment