mvn release:perform 不部署发布版本

Gab*_*abo 6 java eclipse artifactory maven maven-release-plugin

我想在我的项目中使用 maven-release-plugin。我有一个名为 Artifactory 的 Maven 存储库。我可以使用 mvn release:prepare 和 mvn release:perform well,但我不明白为什么将工件部署到libs-snapshot-local而不是libs-release-local

设置.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>
Run Code Online (Sandbox Code Playgroud)

本地 Maven 父

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>
Run Code Online (Sandbox Code Playgroud)

pom-父母

<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>
Run Code Online (Sandbox Code Playgroud)

<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>
Run Code Online (Sandbox Code Playgroud)

我希望pom-parent-${version}出现在libs-release-local 中

Wou*_*ter 2

实际的部署是通过 maven-deploy-plugin 完成的,所以我会尝试在那里配置它。

就像是:

  <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>
Run Code Online (Sandbox Code Playgroud)

查看插件的目标文档以获取选项: https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html