3

How can I force mvn release:perform to deploy to my release and not tom my snapshot repository? release:perform always deploys SNAPSHOT versions. Which makes no sense IMHO

I have in my pom.xml

<groupId>com.mydomain</groupId>
<artifactId>MyArtifactName</artifactId>
<version>1.0.6-SNAPSHOT</version>
<packaging>jar</packaging>


<name>MyArtifactName</name>
<url>http://maven.apache.org</url>
 <distributionManagement>
    <repository>
        <id>central</id>
        <url>http://repo.example.com/artifactory/libs-release-local</url>
        <name>libs-release-local</name>
    </repository>
    <snapshotRepository>
        <id>central</id>
        <url>http://repo.example.com/artifactory/libs-snapshot-local</url>
        <name>libs-snapshot-local</name>
    </snapshotRepository>
</distributionManagement>
<scm>
    <tag>HEAD</tag>
    <url>http://git.example.com/someUser/myproject</url>
    <connection>scm:git:git@git.example.com/someUser/myproject.git</connection>
    <developerConnection>scm:git:git@git.example.com/someUser/myproject.git</developerConnection>
</scm>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.4.2</version>
        </plugin>
    </plugins>
</build>
Tarator
  • 1,517
  • 1
  • 13
  • 30
  • Is the distribution management of your pom.xml correct? http://maven.apache.org/pom.html#Repository – Robert Scholte Feb 02 '14 at 15:15
  • what is the artifact's name and version? – Eddú Meléndez Feb 02 '14 at 16:40
  • I edited the question above. – Tarator Feb 02 '14 at 18:46
  • You are using the same `` for your snapshot and release repositories. Could that be the problem? – Stefan Ferstl Feb 02 '14 at 20:18
  • @Stefan Ferstl: No, this also didn't help. Even with different ID's running a ´mvn release:perform´ always deploys to the SNAPSHOT repo... annoying... somehow... – Tarator Feb 02 '14 at 22:13
  • One more thing: When running "mvn deploy" the artifacts are deployed to the right repos (depending on having SNAPSHOT-QUalifier or not in the version). The problem only occurs with the mvn release plugin... – Tarator Feb 02 '14 at 22:24
  • Are you using Git as version control system? When you configure the maven-release-plugin with the `suppressCommitBeforeTag` flag, you'll have exactly the effect you are describing. It would be helpful if you could add more information about your POM file to your question, e.g. the configuration of the maven-release-plugin, scm settings, etc. – Stefan Ferstl Feb 03 '14 at 07:15
  • @StefanFerstl thanks, for your answer, I provided a little bit more information above. One thing I realized is, that the pom.xml in the tagged version created by "mvn release:prepare" still has the SNAPSHOT-qualifier.,, – Tarator Feb 03 '14 at 18:13

1 Answers1

8

I found the problem: The problem is, that I needed to update the maven-scm-provider-gitexe dependency, for the maven-release-plugin (version 2.4.2), when using Git as SCM:

<build>
    <plugins>
        ....
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.4.2</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-gitexe</artifactId>
                    <version>1.9</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

I found the solution here: mvn release:prepare not committing changes to pom.xml

You can find a working example here: https://github.com/tarator/releaseplugintest

Community
  • 1
  • 1
Tarator
  • 1,517
  • 1
  • 13
  • 30