Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvn release:perform doesn't deploy release version

I would like to use maven-release-plugin in my project. I have a maven repository called Artifactory. I can use mvn release:prepare and mvn release:perform well, but I don't understand why deploy the artifact to libs-snapshot-local and doesn't libs-release-local.

settings.xml:

<server>
    <id>local-artifactory</id>
    <username>user</username>
    <password>password</password>
</server>
...
<mirror>
  <id>local-artifactory</id>
  <mirrorOf>*</mirrorOf>
  <url>http://localhost:8081/artifactory/repo</url>
</mirror>

local-maven-parent:

enter code here<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>examples</groupId>
<artifactId>local-maven-parent</artifactId>
<version>1</version>
<packaging>pom</packaging>

<repositories>
    <repository>
        <id>local-artifactory</id>
        <name>Local Central Repository</name>
        <url>http://localhost:8081/artifactory/repo</url>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>

<distributionManagement>
    <repository>
        <id>local-artifactory</id>
        <name>Local Release Repository</name>
        <url>http://localhost:8081/artifactory/libs-release-local</url>
    </repository>
    <snapshotRepository>
        <id>local-artifactory</id>
        <name>Local Snapshot Repository</name>
        <url>http://localhost:8081/artifactory/libs-snapshot-local</url>
    </snapshotRepository>
</distributionManagement>

pom-parent:

<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>

<parent>
    <groupId>examples</groupId>
    <artifactId>local-maven-parent</artifactId>
    <version>1</version>
</parent>

<scm>
    <developerConnection>scm:git:git@local-scm:demo.git</developerConnection>
  <tag>HEAD</tag>

<artifactId>pom-parent</artifactId>
<version>1.0.11-SNAPSHOT</version>
<packaging>pom</packaging>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
                <execution>
                    <id>default</id>
                    <goals>
                        <goal>perform</goal>
                    </goals>
                    <configuration>
                        <pomFileName>../${project.artifactId}/pom.xml</pomFileName>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

I want the pom-parent-${version} appear in libs-release-local.

like image 566
Gabor Szabo Avatar asked Feb 18 '14 14:02

Gabor Szabo


People also ask

What does Mvn Release perform do?

release:perform will fork a new Maven instance to build the checked-out project. This new Maven instance will use the same system configuration and Maven profiles used by the one running the release:perform goal.

What is Maven release version?

This plugin is used to release a project with Maven, saving a lot of repetitive, manual work. Releasing a project is made in two steps: prepare and perform. Note: Maven 3 users are encouraged to use at least Maven-3.0.

How does Mvn release rollback execute when Maven release plugin works?

When a release is rolled back, the following release phases are executed by default: All project POMs are reverted back to their pre-release state locally, and also in the SCM if the previous release command was able to successfully make changes in the SCM to the POMs.


2 Answers

The actual deployment is done via the maven-deploy-plugin, so I would try and configure it there.

Something like:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.8.1</version>
    <configuration>
         <altReleaseDeploymentRepository>local-artifactory::default::http://localhost:8081/artifactory/libs-release-local</altReleaseDeploymentRepository>
    </configuration>
  </plugin>

Checkout the goal documentation for the plugin for the options: https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html

like image 188
Wouter Avatar answered Sep 29 '22 15:09

Wouter


This is a old question, record my answer here if anyone got here.

TL;DR Upgrade the Maven Release Plugin to the latest version.

Refer: This issue is resolved with the combination of Maven 3.2.2 and Maven Release Plugin 2.5

Follow the processes to check: Maven Release Plugin - Prepare a Release

  1. Base on Tag the code in the SCM with a version name: check the tag, it marks on a commit which pom.xml is a RELEASE version without SNAPSHOT

  2. Commit the modified POMs: check the new version which contains SNAPSHOT

If any step is incorrect, the release plugin is not working properly.

like image 36
Peter Avatar answered Sep 29 '22 16:09

Peter