Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven release:perform overwriting first ever release for every subsequent release
    primarykey
    data
    text
    <p><strong>Update</strong> I am flagging this question to be closed as there seems to be no solution - the plugin is simply not behaving as it should and no-one seems to know why. I have ended up writing a small program to manually replicate the desired behaviour of the release plugin myself, using other plugins such as <code>scm</code> and <code>versions</code>. If you would like information on how I did this feel free to email me.</p> <hr> <p>I have recently moved my project to maven. However, I am having issues with the release process.</p> <p>My release procedure is as follows:</p> <pre><code>mvn scm:checkout -DconnectionUrl=scm:svn:https://my-server/svn/my-project/trunk -DcheckoutDirectory=my-project cd my-project mvn --batch-mode release:prepare mvn release:perform </code></pre> <p>I start on <code>1.0.0-SNAPSHOT</code>, I run the release procedure shown above. This updates my repo to the following (in ascending order of newness):</p> <pre><code>1.0.0-SNAPSHOT 1.0.0 1.0.1-SNAPSHOT </code></pre> <p>Everything occurs as expected, including the <code>pom.xml</code> updated to point to <code>1.0.1-SNAPSHOT</code> and a tag called <code>my-project-1.0.0</code> created in my SCM. However, when I run the procedure again, the following appears in my repo:</p> <pre><code>1.0.0-SNAPSHOT 1.0.1-SNAPSHOT 1.0.0 1.0.2-SNAPSHOT </code></pre> <p>That is, release 1.0.1 is never created, and instead 1.0.1-SNAPSHOT is released to 1.0.0. Note that every other aspect runs as expected - the <code>pom.xml</code> now points to <code>1.0.2-SNAPSHOT</code> and a tag is created in my SCM with the name <code>my-project-1.0.1</code>.</p> <p>In fact, every time I run the release procedure, the SNAPSHOT increases but the release is written to 1.0.0 with a new release never created. For example, re-running the release procedure 3 further times results in the following: </p> <pre><code>1.0.0-SNAPSHOT 1.0.1-SNAPSHOT 1.0.2-SNAPSHOT 1.0.3-SNAPSHOT 1.0.4-SNAPSHOT 1.0.0 1.0.5-SNAPSHOT </code></pre> <p>The expected behaviour for the above is:</p> <pre><code>1.0.0-SNAPSHOT 1.0.0 1.0.1-SNAPSHOT 1.0.1 1.0.2-SNAPSHOT 1.0.2 1.0.3-SNAPSHOT 1.0.3 1.0.4-SNAPSHOT 1.0.4 1.0.5-SNAPSHOT </code></pre> <p>The <code>pom.xml</code> for the very first version is shown below:</p> <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" x mlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.foo&lt;/groupId&gt; &lt;artifactId&gt;my-project&lt;/artifactId&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt; &lt;name&gt;my-project&lt;/name&gt; &lt;distributionManagement&gt; &lt;repository&gt; &lt;id&gt;my-server&lt;/id&gt; &lt;url&gt;file://\\my-server\repo\&lt;/url&gt; &lt;/repository&gt; &lt;/distributionManagement&gt; &lt;scm&gt; &lt;developerConnection&gt;scm:svn:https://my-server/svn/my-project&lt;/developerConnection&gt; &lt;/scm&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-release-plugin&lt;/artifactId&gt; &lt;version&gt;2.4.1&lt;/version&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;repositories&gt; &lt;repository&gt; &lt;id&gt;my-server&lt;/id&gt; &lt;url&gt;file://\\my-server\repo\&lt;/url&gt; &lt;/repository&gt; &lt;/repositories&gt; &lt;/project&gt; </code></pre> <p>One of the answers below suggests I should create a separate <code>release</code> and <code>snapshot</code> repo, which I have not. Could this be causing the issue?</p> <p>Note that I am using Jenkins to automatically invoke <code>mvn deploy</code> whenever code is committed. However this is acting exactly as expected (i.e. deploying whichever version is specified in the committed <code>pom.xml</code> to the repo) so I doubt this is part of the problem.</p> <p>Many thanks for any assistance.</p> <hr> <p><strong>Update</strong></p> <p>Examining the output from the <code>mvn release:perform</code> command I see the following:</p> <pre><code>Checking out the project to perform the release ... Executing: cmd.exe /X /C "svn --non-interactive checkout https://my-server/svn/my-project/tags/my-project-1.0.2 c:\localrelease\mvn\my-project\target\checkout" Working directory: c:\localrelease\mvn\my-project\target Invoking perform goals in directory c:\localrelease\mvn\my-project\target\checkout\tags\my-project-1.0.0\trunk Executing goals 'deploy'... </code></pre> <p>And there is the reason it is releasing to <code>1.0.0</code> every time - it checks out the updated tag, but releases on the old <code>1.0.0</code> tag (even though the <code>1.0.1</code> tag IS present in the target/checkout folder). Why is it doing this?</p> <hr> <p><strong>Update 2</strong></p> <p>I have split to 2 separate repositories (one for snapshot and one for target) and this issue still occurs.</p> <p>Also, something I have noticed upon investigating log for <code>release:perform</code> further: The checkout for tag <code>my-project-1.0.1</code> contains the tag for <code>1.0.0</code>. Similarly, the checkout for tag <code>1.0.2</code> contains the tags <code>1.0.0</code> and <code>1.0.1</code>, etc. Is this correct behaviour?</p> <p>Perhaps the release process is always looking in the tags folder of whatever it checks out and uses the first one it finds, which will always be <code>1.0.0</code> for every releases <em>except</em> the first release.</p> <p>This seems like a very strange explanation but it is the only one I have so far for the behaviour I see. The question now is, what have I configured in my <code>pom.xml</code> incorrectly to cause this to happen?</p> <p>Another note: when performing the release the deploy goal complains that <code>'build.plugins.plugin.version' for org.apache.maven.plugins:maven-xxxx-plugin is missing.</code> for <code>maven-javadoc-plugin</code>, <code>maven-deploy-plugin</code> and <code>maven-source-plugin</code>. Do I need to explicitly add these?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload