我想我误解了使用 maven-release-plugin 导入的东西。我能够mvn release:prepare
成功,但mvn release:perform
总是失败。
Maven版本:
Apache Maven 3.0.3 (r1075438; 2011-02-28 11:31:09-0600)
Maven home: C:\Program Files\apache-maven-3.0.3
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
我的 POM.xml:
<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>com.animals</groupId>
<artifactId>cats</artifactId>
<version>0.0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>cats</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<connection>scm:hg:https://repo.org/repo</connection>
<developerConnection>scm:hg:https://repo.org/repo</developerConnection>
</scm>
<build>
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<preparationGoals>clean install</preparationGoals>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>repo</id>
<url>https://repo.org/repo</url>
<uniqueVersion>false</uniqueVersion>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
我运行时遇到的错误mvn release:perform
是:
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plug
in:2.5:deploy (default-deploy) on project cats: Failed to deploy artifacts: Coul
d not find artifact com.animals:cats:jar:0.0.1 in repo (https://my-repo-url)
我真的不知道为什么会这样。我尝试设置一个单独的存储库,release:perform
但没有运气,我尝试使用相同的存储库release:prepare
和release:perform
,我尝试省略该<distributionManagement/>
部分。我还尝试将 maven-release-plugin 中的准备目标更改为clean install
. 所有这些都是其他 stackoverflow 用户发现有用的解决方案,但不幸的是他们在这种情况下不起作用。
是我的 pom.xml 配置中的问题,还是其他问题?如果您可能需要任何其他信息,请告诉我!感谢您的时间和帮助!
编辑:这是一个非常简单的项目,没有模块。0.0.1-SNAPSHOT 是我当前定义的版本,所有其他 Maven 目标似乎都没有问题。我没有使用任何个人资料。
编辑我已经编辑了这个问题以包括我的整个 POM.xml。