0

Snapshot version is not published on snapshot repository but release version is published instead.

Release is successful. No errors.

Only change is upgrade of release plugin from 2.3.2 to 2.5.2

Also tried 2.5.1 and 2.5.3 but none worked.

Using apache maven 3.5.0

Steps:

  • mvn clean install
  • mvn release:prepare
  • mvn release:perform

Output: Build Success in all three

Not sure if I can attach actual logs

snippet pom.xml

<artifactId>maven-clean-plugin</artifactId>
                <version>2.5</version>
<artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
<artifactId>maven-overview-plugin</artifactId>
                <version>1.6</version>
 <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.3</version>
<artifactId>maven-dependency-plugin</artifactId>
                    <version>2.5</version>
<artifactId>maven-release-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <scmCommentPrefix>: Release by maven </scmCommentPrefix>
                        <tagNameFormat>bcd-@{project.version}</tagNameFormat>
                        <arguments>-Denvironment=target</arguments>
                    </configuration>

<repository>
            <id>apache.snapshots</id>
            <url>https://repository.apache.org/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

<distributionManagement>
        <repository>
            <id>arm</id>
            <name>Internal release Repository</name>
            <url>url1</url>
        </repository>
        <snapshotRepository>
            <id>arm</id>
            <name>Internal Repository</name>
            <url>url2</url>
        </snapshotRepository>
nidhi
  • 61
  • 9

2 Answers2

2

Your problem is caused by issue MRELEASE-812 in the Maven Release plugin affecting 2.3.2 and solved since 2.5. However, the plugin is actually supposed to publish the Release version of your app, not the Snapshot version. When you say:

Snapshot version is not published on snapshot repository but release version is published instead.

Snapshot version is not supposed to be published on repository when using the Release plugin. Publication of the release version is actually expected. Detailed explanation below.

What should happen when you use mvn release:prepare release:perform:

  1. release:prepare will update your project from version x.y.z-SNAPSHOT to x.y.z (the "release" version of your project) commit+push all changes into your Git repository (or any other SCM) and create a tag named bcd-x.y.z
  2. release:perform will checkout/pull from the tagged release bcd-x.y.z release and deploy it on your repository
  3. The release version x.y.z is now deployed on your Repo.

This is actually what happened when you used version 2.5.2 of the Release plugin, and is actually the expected and normal behavior.

Here is what happened when you used version 2.3.2 of the plugin:

  1. release:prepare updated your project from version x.y.z-SNAPSHOT to x.y.z, the "release" version of your project, however the changes never got pushed to Git due to MRELEASE-812. A tagged thus got created using the x.y.z-SNAPSHOT version of your project instead of the proper release version because the changes updating your version number never got pushed.
  2. release:perform will checked out the *improperly named * tag bcd-x.y.z actually containing the x.y.z-SNAPSHOT version and deployed it on your repository as a SNAPSHOT.
  3. The snapshot version x.y.z-SNAPSHOT was now available on your repo.

Maven never shown any error but this is not proper behavior. Your real issue was actually with your previous usage of the Plugin, and your build is now having the expected behavior ;)

What you can do:

  • I recommend you keep your actual configuration with the recent Plugin version. Keep in mind that the Maven Release Plugin is to publish releases of your app, not snapshots.
  • If you want to publish SNAPSHOT versions to your repository, use mvn deploy on a revision containing a SNAPSHOT version instead of creating a release.

Hope this helps. Do not hesitate to ask details I'll update my answer.

Pierre B.
  • 11,612
  • 1
  • 37
  • 58
0

This is expected as per the command/goals you are using:

  • mvn clean install installs your SNAPSHOT dependency on your local repository but it DOES NOT deploy it on your Maven repository
  • mvn release:prepare update your POMs for a release version and update your SCM with tag
  • mvn release:perform actually deploys your release on repository

Your SNAPSHOT nevers get deployed on any repository. To achieve this, you should run the deploy:deploy goal before using the release:* goals. For example:

mvn clean install deploy:deploy release:prepare release:perform 

Equivalent to:

mvn clean deploy release:prepare release:perform 

Note that your pom.xml and repository should be properly configured to allow the deployment of SNAPSHOT artifacts.

Pierre B.
  • 11,612
  • 1
  • 37
  • 58
  • when I use maven release plugin 2.3.2 version , I can publish snapshot in snapshot repo but nothing is published in release repo. – nidhi Nov 03 '17 at 10:00
  • I don't understand, what do you mean? – Pierre B. Nov 03 '17 at 10:02
  • There is 1 diff in the logs of 2 versions. I can see : scmCommentPrefix = Release by maven and push changes = true in version 2.3.2 . There is no such info in version 2.5.2. – nidhi Nov 03 '17 at 10:21
  • I don"t think that's causing the issue. Please provide your pom.xml in your question. You run EXACTLY the same command using both versions of the plugin? How did you publish your snapshot using the 2.5.2? – Pierre B. Nov 04 '17 at 09:23
  • yes , I run exactly same commands in both versions of plugin. – nidhi Nov 06 '17 at 03:03
  • Pls let me know tags you want to have info about. Added some info in the question. – nidhi Nov 06 '17 at 03:45
  • Can you please include your entire pom.xml and build logs for both version's run? That'd help diagnose your issue. – Pierre B. Nov 06 '17 at 07:59
  • Is it possible for you to share your email where I can send the files? – nidhi Nov 06 '17 at 08:10
  • https://wetransfer.com/downloads/78d81f2005d16d14af04e1ff87e96ea720171106082811/b3cdc6 – nidhi Nov 06 '17 at 08:30
  • Can't you copy-paste them directly on your question? If not use a service such as https://pastebin.com – Pierre B. Nov 06 '17 at 08:31
  • These files contain logs upon execution of maven commands. Name indicates the release plugin version. – nidhi Nov 06 '17 at 08:34
  • Thanks for the details. It is indeed a different issue than the one I talked about earlier, maybe combined with a misinterpretation of what the Release Plugin should do. I'll post another detailed answer in a few moments. – Pierre B. Nov 06 '17 at 11:02