我想在我的项目中使用maven-release-plugin。我有一个名为Artifactory的maven存储库。我可以使用mvn release:prepare和mvn release:表现不错,但我不明白为什么要将工件部署到 libs-snapshot-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>
本地-行家-父 :
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-父 :
<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>
我希望 pom-parent - $ {version} 出现在 libs-release-local 中。
答案 0 :(得分:1)
实际部署是通过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>
查看选项插件的目标文档: https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html
答案 1 :(得分:1)
这是一个老问题,如果有人到了这里,请在这里记录我的答案。
TL; DR将Maven版本插件升级到最新版本。
引用:This issue is resolved with the combination of Maven 3.2.2 and Maven Release Plugin 2.5
请按照以下过程进行检查: Maven Release Plugin - Prepare a Release
基于标签SCM中具有版本名称的代码:检查标签,在提交时标记pom.xml是不带快照的发布版本
< / li>提交修改后的POM :检查包含SNAPSHOT的新版本
如果任何步骤不正确,则说明发布插件无法正常工作。