Maven Shared Components
  1. Maven Shared Components
  2. MSHARED-191

Specification-Version must not contain "-SNAPSHOT"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: maven-archiver-2.4.1
    • Fix Version/s: maven-archiver-3.0.1
    • Component/s: maven-archiver
    • Labels:
      None
    • Environment:
      Ubuntu 10.10, Maven 2.2.1 and Maven 3.0.3, OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1) (64 bits)
      Mint 17.1, Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode), Maven 3.2.5
    • Flags:
      Patch

      Description

      When building an artifact with a SNAPSHOT version,
      Specification-Version and Implementation-Version are both set to ${pom.version} (as described in the documentation).

      But this will break the deployment in a container like WebLogic Server 10.3.4.
      This behavior is compliant with specification
      http://download.oracle.com/javase/6/docs/technotes/guides/versioning/spec/versioning2.html#wp89939
      where it is said that "Specification version numbers use a Dewey decimal notation consisting of numbers seperated by periods"

      Further in this spec, in § "1.5.10 Rationale for limiting Implementation version numbers to identity", it is explained why Implementation-Version need to be compared strictly for equality.

      So we can understand that:

      • Specification-Version must NOT have "-SNAPSHOT" suffix. This is legal to keep only the beginning of ${pom.version}, because it represents the spec version, not the build ;
      • Implementation-Version has to be set to ${pom.version} to represent the exact version of the build.

      This used to be the behavior in Maven 1:
      http://maven.apache.org/maven-1.x/plugins/jar/manifest.html

      1. MSHARED-191.patch
        8 kB
        Michael Osipov

        Issue Links

          Activity

          Hide
          Joerg Schaible added a comment -
          Show
          Joerg Schaible added a comment - At least there is a workaround: http://article.gmane.org/gmane.comp.jakarta.commons.devel/113911
          Hide
          Michael Osipov added a comment -

          Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          Show
          Michael Osipov added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.
          Hide
          Romain Buquet added a comment -

          I read through "The Great JIRA Cleanup of 2014" article. I understand your motivations. It's a tough move, with the risk of a lot of frustrations. But it is for the best. Good job!

          Now for my issue, I'm asking to reopen it because I think that it is compliant with your legitimate conditions: it's clearly described, the bug violates a Java specification, a patch candidate is provided, and it looks that it will not be too long to fix...

          Hope you will agree with me, and that we can close this issue once and for all!

          Show
          Romain Buquet added a comment - I read through "The Great JIRA Cleanup of 2014" article. I understand your motivations. It's a tough move, with the risk of a lot of frustrations. But it is for the best. Good job! Now for my issue, I'm asking to reopen it because I think that it is compliant with your legitimate conditions: it's clearly described, the bug violates a Java specification, a patch candidate is provided, and it looks that it will not be too long to fix... Hope you will agree with me, and that we can close this issue once and for all!
          Hide
          Michael Osipov added a comment - - edited

          Perfectly fine that you have reopened this issue. Can you check the patch against trunk, run all tests and update if necessary? I would be included to merge this one.

          Show
          Michael Osipov added a comment - - edited Perfectly fine that you have reopened this issue. Can you check the patch against trunk, run all tests and update if necessary? I would be included to merge this one.
          Hide
          Romain Buquet added a comment -

          Sorry for the delay.
          I tried again with Maven 3.2.5 (the last version with Java 6 support that I have to stick with), with war-plugin version 2.6 (maven-archiver-2.6).
          Still the same behavior: Specification-Version and Implementation-Version have the same value (i.e. with "-SNAPSHOT").

          Show
          Romain Buquet added a comment - Sorry for the delay. I tried again with Maven 3.2.5 (the last version with Java 6 support that I have to stick with), with war-plugin version 2.6 (maven-archiver-2.6). Still the same behavior: Specification-Version and Implementation-Version have the same value (i.e. with "-SNAPSHOT").
          Hide
          Michael Osipov added a comment -

          To pick this up, what about version qualifiers, are they valid? We have to consider all states.

          Show
          Michael Osipov added a comment - To pick this up, what about version qualifiers, are they valid? We have to consider all states.
          Hide
          Michael Osipov added a comment -

          Would it be an acceptible solution to strip out -SNAPSHOT? The other option I see is to work with MavenProject#getArtifact.

          Show
          Michael Osipov added a comment - Would it be an acceptible solution to strip out -SNAPSHOT ? The other option I see is to work with MavenProject#getArtifact .
          Hide
          Jörg Sesterhenn added a comment -

          I think that the proposed solution by Joerg Schaible (using majorVersion.minorVersion for spec-version) would be an ideal default since the spec-version must look like int(.int)* with int >=0. Compare MSHARED-432.

          Leave everything else including qualifiers to the implementation-version.

          Show
          Jörg Sesterhenn added a comment - I think that the proposed solution by Joerg Schaible (using majorVersion.minorVersion for spec-version) would be an ideal default since the spec-version must look like int(.int)* with int >=0. Compare MSHARED-432 . Leave everything else including qualifiers to the implementation-version.
          Hide
          Michael Osipov added a comment -

          I agree. What I would change now is instead of

          project.getVersion()
          

          to

          ArtifactVersion version = project.getArtifact().getArtifactVersion();
          String specVersion = String.format("%s.%s", version.getMajorVersion(), version.getMinorVersion());
          

          Is that acceptable?

          Show
          Michael Osipov added a comment - I agree. What I would change now is instead of project.getVersion() to ArtifactVersion version = project.getArtifact().getArtifactVersion(); String specVersion = String .format( "%s.%s" , version.getMajorVersion(), version.getMinorVersion()); Is that acceptable?
          Hide
          Jörg Sesterhenn added a comment -

          Absolutely, as far as I am concerned.

          Show
          Jörg Sesterhenn added a comment - Absolutely, as far as I am concerned.
          Hide
          Jörg Sesterhenn added a comment -

          What is the target for this? Will this make it into 3.0.1?

          Show
          Jörg Sesterhenn added a comment - What is the target for this? Will this make it into 3.0.1?
          Hide
          Michael Osipov added a comment - - edited

          I'll wait for other opinions or even better ideas for a couple of days. If no one opposes, I will do the change.

          Show
          Michael Osipov added a comment - - edited I'll wait for other opinions or even better ideas for a couple of days. If no one opposes, I will do the change.
          Hide
          Romain Buquet added a comment -

          This is OK for me. Thanks!

          Show
          Romain Buquet added a comment - This is OK for me. Thanks!
          Hide
          Michael Osipov added a comment - - edited

          Hi folks,

          I have created a patch which solves the issue. Though, I am quite uncertain about the selected version operation, especially the impact it might have. Alternatively, one could use DefaultArtifactVersion and get the bits from there.

          Please test the patch and post you (negative) results. I would like to avoid using DefaultArtifactVersion which is an implementation detail. I would like to stick to getSelectedVersion.

          Show
          Michael Osipov added a comment - - edited Hi folks, I have created a patch which solves the issue. Though, I am quite uncertain about the selected version operation, especially the impact it might have. Alternatively, one could use DefaultArtifactVersion and get the bits from there. Please test the patch and post you (negative) results. I would like to avoid using DefaultArtifactVersion which is an implementation detail. I would like to stick to getSelectedVersion .
          Hide
          Michael Osipov added a comment -

          Fixed with r1722470.

          Show
          Michael Osipov added a comment - Fixed with r1722470 .
          Hide
          Hudson added a comment -

          SUCCESS: Integrated in maven-shared #845 (See https://builds.apache.org/job/maven-shared/845/)
          MSHARED-191 Specification-Version must not contain "-SNAPSHOT" (michaelo: http://svn.apache.org/viewvc/?view=rev&rev=1722470)

          • maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java
          • maven-archiver/src/site/apt/examples/manifest.apt
          • maven-archiver/src/site/xdoc/index.xml.vm
          • maven-archiver/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java
          • maven-archiver/src/test/java/org/apache/maven/archiver/MockArtifact.java
          Show
          Hudson added a comment - SUCCESS: Integrated in maven-shared #845 (See https://builds.apache.org/job/maven-shared/845/ ) MSHARED-191 Specification-Version must not contain "-SNAPSHOT" (michaelo: http://svn.apache.org/viewvc/?view=rev&rev=1722470 ) maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java maven-archiver/src/site/apt/examples/manifest.apt maven-archiver/src/site/xdoc/index.xml.vm maven-archiver/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java maven-archiver/src/test/java/org/apache/maven/archiver/MockArtifact.java
          Hide
          Hudson added a comment -

          FAILURE: Integrated in maven-plugins #5674 (See https://builds.apache.org/job/maven-plugins/5674/)
          MJAR-213 Upgrade to maven-archiver 3.0.1
          o Upgrading to maven-archiver-3.0.1 means that the
          Specification-Version within the MANIFEST.MF
          does not allow having -SNAPSHOT.
          This behaviour has been changed according to
          the Product Versioning Spec. See also MSHARED-191 (khmarbaise: http://svn.apache.org/viewvc/?view=rev&rev=1738620)

          • maven-jar-plugin/pom.xml
          • maven-jar-plugin/src/it/MJAR-82/pom.xml
          • maven-jar-plugin/src/it/manifest-content/verify.bsh
          Show
          Hudson added a comment - FAILURE: Integrated in maven-plugins #5674 (See https://builds.apache.org/job/maven-plugins/5674/ ) MJAR-213 Upgrade to maven-archiver 3.0.1 o Upgrading to maven-archiver-3.0.1 means that the Specification-Version within the MANIFEST.MF does not allow having -SNAPSHOT. This behaviour has been changed according to the Product Versioning Spec. See also MSHARED-191 (khmarbaise: http://svn.apache.org/viewvc/?view=rev&rev=1738620 ) maven-jar-plugin/pom.xml maven-jar-plugin/src/it/ MJAR-82 /pom.xml maven-jar-plugin/src/it/manifest-content/verify.bsh

            People

            • Assignee:
              Michael Osipov
              Reporter:
              Romain Buquet
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development