Steve Holt
Steve Holt

Reputation: 85

mvn release plugin releasing next snapshot not current release

Hello I've been releasing a project from my workstation with no problems. I've recently tried releasing another project from 1.0.0-SNAPSHOT. However when it actually does the release it releases 1.0.1-SNAPSHOT to the snapshots repository instead of 1.0.0 to releases repository. I've done dryRun=true and it seems fine. In fact it defaults me to the versions:

What is the release version for "Appname"? (...) 1.0.0: :
What is SCM release tag or label for "Appname"? (...) Appname-1.0.0: :
What is the new development version for "Appname"? (...) 1.0.1-SNAPSHOT: :

I take all the defaults. However when i do the "mvn release:perform" This is what it does:

[INFO] Uploading: http://{corporate-nexus-site}/snapshots/{app-path}/1.0.1-SNAPSHOT/fei-logging-formatter-1.0.1-20140929.153303-1.jar
...
[INFO] [INFO] BUILD SUCCESS

I'm using latest maven and i manually added latest release plugin. And I can release another project using same parent and settings.xml setup. Looking at the properties file after a dryrun and prepare it all looks right to me. I thought originally i had my distribution set up wrong, and was releasing a release to the snapshot repository, but as you can see its actually thinking its doing a good job and releasing a snapshot.

confused royally.

Any ideas on what to try?

thanks.

UPDATE: In the project I updated the pom from 1.0.0-SNAPSHOT to 1.0.0 and did a "mvn deploy" and it put it exactly where I expected in releases, without out all the goodies of course.

UPDATE2: Pom (company name to protect the guilty)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>logging-formatter</groupId>
    <artifactId>logging-formatter</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <name>Logging Formatter</name>
    <description>logging tool to format your logging in the standard cn way.</description>
    <parent>
        <groupId>com.companyname.pom.parent.master</groupId>
        <artifactId>cn-pom-parent-master</artifactId>
        <version>2014.3.0</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
    </build>
    <scm>
        <url>http://svn.sys.ds.companyname.com/svn/cn-logging</url>
        <connection>scm:svn:http://svn.sys.ds.companyname.com/svn/cn-logging</connection>
        <developerConnection>scm:svn:http://svn.sys.ds.companyname.com/svn/cn-logging</developerConnection>
    </scm>
    <organization>
        <name>CompanyName Enterprises</name>
    </organization>
    <ciManagement>
        <system>Jenkins</system>
        <url>http://jenkins.sys.ds.companyname.com:8080/job/cn-logging-DEVELOP/</url>
    </ciManagement>
</project>

UPDATE3: Adding parent settings info

      SETTINGS.XML
      <repositories>
        <repository>
          <id>fei-releases</id>
          <name>Ferguson Release Repository</name>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
          </snapshots>
          <url>http://{companyname}/nexus/content/repositories/releases</url>
          <layout>default</layout>
        </repository>
        <repository>
          <id>fei-snapshots</id>
          <name>Ferguson Snapshot Repository</name>
          <releases>
            <enabled>false</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </snapshots>
          <url>http://{companyname}/nexus/content/repositories/snapshots/</url>
          <layout>default</layout>
        </repository>
        <repository>
          <id>fei-thirdparty</id>
          <name>Ferguson 3rd Party Repository</name>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
          </snapshots>
          <url>http://{companyname}/nexus/content/repositories/thirdparty/</url>
          <layout>default</layout>
        </repository>
      </repositories>

      PARENT REPOSITORIES:
    <repositories>
      <repository>
        <id>third-party</id>
        <name>3rd Party Repository</name>
        <url>http://{companyname}/nexus/content/repositories/thirdparty/</url>
        <layout>default</layout>
      </repository>
    </repositories>
    <pluginRepositories/>

    PARENT DISTRIBUTION MANAGEMENT:
    <distributionManagement>
    <repository>
      <id>fei-releases</id>
      <name>Ferguson Release Repository</name>
      <url>http://{companyname}/nexus/content/repositories/releases</url>
      <layout>default</layout>
    </repository>
    <snapshotRepository>
      <id>fei-snapshots</id>
      <name>Ferguson Snapshot Repository</name>
      <url>http://{companyname}/nexus/content/repositories/snapshots</url>
      <layout>default</layout>
    </snapshotRepository>
  </distributionManagement>

Upvotes: 0

Views: 1444

Answers (2)

333kenshin
333kenshin

Reputation: 2045

@SteveHolt,

I see a red flag in your pom.xml file:

<scm>
    <url>http://svn.sys.ds.companyname.com/svn/cn-logging</url>
    <connection>scm:svn:http://svn.sys.ds.companyname.com/svn/cn-logging</connection>
    <developerConnection>scm:svn:http://svn.sys.ds.companyname.com/svn/cn-logging</developerConnection>
</scm>

None of these urls contain the trunk, branches, or tags keywords.

Consequently, when Maven creates the release tag, it tells SVN to use the same url as before:

http://svn.sys.ds.companyname.com/svn/cn-logging

When release-prepare runs, it performs

$ svn checkout http://svn.sys.ds.companyname.com/svn/cn-logging/

but it can't tell apart the release tag from the development trunk.

Therefore it retrieves the post-release snapshot revision (which is the latest commit) rather than the release revision (the preceding commit).

Solution:

Create a trunk dir under cn-logging and move all your code into it:

svn/cn-logging/
    trunk/
        pom.xml
        src/
            main/
            java/
    branches/
    tags/

Hope that helps.

Upvotes: 0

OhadR
OhadR

Reputation: 8839

i did a "mvn release:clean release:prepare" then a "mvn release:perform" Same steps I used to release another project without issue using the same parent.

So you have another project that is deployed fine after release? (you see the release version in the repo)?

If so, it sounds like an issue in your 'problematic' project. Can you share its pom.xml?

Upvotes: 0

Related Questions