release:perform 有问题,但release:prepare 没有问题

发布于 2024-11-14 08:24:51 字数 3088 浏览 1 评论 0原文

我认为我误解了 maven-release-plugin 的某些导入内容。我能够成功执行 mvn release:preparemvn 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:preparerelease:perform< 使用相同的存储库/code>,我尝试省略 部分。我还尝试将 maven-release-plugin 中的准备目标更改为“干净安装”。所有这些都是其他 stackoverflow 用户发现很有帮助的解决方案,但不幸的是它们在这种情况下不起作用。

问题出在我的 pom.xml 配置中,还是其他什么地方?如果您可能需要任何其他信息,请告诉我!感谢您的时间和帮助!

编辑:这是一个非常简单的项目,没有模块。 0.0.1-SNAPSHOT 是我当前定义的版本,所有其他 Maven 目标似乎都可以正常工作。我没有使用任何配置文件。

编辑 我已经编辑了问题以包含我的整个 POM.xml。

I think I am misunderstanding something import with the maven-release-plugin. I am able to do mvn release:prepare successfully but mvn release:perform always fails.

Maven version:

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"

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

The error that I am getting when I run mvn release:perform is:

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

I am really at a loss as to why this is happening. I have tried setting up a separate repository just for release:perform but no luck, I have tried using the same repository for release:prepare and release:perform, I have tried omitting the <distributionManagement/> section. I have also tried changing the preparetion goals in the maven-release-plugin to be clean install. All of these are solutions that other stackoverflow users have found to be helpful but unfortunately they are not working in this case.

Is the problem in my pom.xml configuration, or perhaps something else? If there is any other information that you might need please let me know! I appreciate your time and help!

EDIT: This is a very simple project with no modules. 0.0.1-SNAPSHOT is the version I have currently defined, and all other Maven goals seem to be working with no issue. I am not using any profile.

EDIT I have edited the question to include my entire POM.xml.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

起风了 2024-11-21 08:24:51

将其放入发布插件的配置中:install

Put this to the configuration of the release plugin: <goals>install</goals>

临走之时 2024-11-21 08:24:51

看来,您需要 mvn release:stage 而不是 release:perform

Seems, that you need mvn release:stage instead of release:perform

心意如水 2024-11-21 08:24:51

解决了这个问题。问题确实出在我的存储库上,而不是 pom.xml 上。

Fixed the issue. The problem was indeed with my repositories and not the pom.xml.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文