我想我誤解了使用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。
你有一個多模塊構建?你有沒有在mvn發佈前定義類似0.0.1-SNAPSHOT的版本:prepare/mvn release:perform?你的構建是否適用於mvn clean package等?你需要激活一些配置文件嗎? – khmarbaise 2011-06-07 19:32:06
感謝您的快速響應。我會用答案更新問題 – 2011-06-07 19:34:45
你可以發佈完整的POM嗎? – khmarbaise 2011-06-07 22:11:39