gpt4 book ai didi

java - 从 Maven 部署到 bintray 失败

转载 作者:行者123 更新时间:2023-11-30 03:56:53 26 4
gpt4 key购买 nike

我已经根据Publishing releases using Github, Bintray and maven-release-plugin 为Java项目设置了maven构建。 ,Andreas Veithen 的博客文章。

我的 pom 版本是 1.0.2-SNAPSHOT,并且我在 bintray 包中创建了相应的版本 1.0.2。我执行mvn -Prelease clean install,没有问题。我执行mvn release:prepare,没有问题。但是当我执行 mvn release:perform 时,构建会中断并显示以下错误消息。

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy 
(default-deploy) on project [PROJECT]: Failed to deploy artifacts: Could not
transfer artifact my.project:test:jar:1.0.2-20140408.154954-1 from/to bintray-
user-maven-package (https://api.bintray.com/maven/user/maven/package): Failed to
transfer file: https://api.bintray.com/maven/user/maven/package/my/project/test/
1.0.2-SNAPSHOT/test-1.0.2-20140408.154954-1.jar. Return code is: 400,
ReasonPhrase: Bad Request. -> [Help 1]

我注意到发布插件正在尝试上传SNAPSHOT,当然这应该在 bintray 上没有位置...我本以为它会尝试部署<强>1.0.2?我怎样才能说服maven上传正确的 Artifact ,或者我的设置有什么问题?

以下是我认为相关的 POM 部分,完整的 POM 位于 pastebin .

<modelVersion>4.0.0</modelVersion>
<groupId>my.tool</groupId>
<artifactId>util</artifactId>
<packaging>jar</packaging>
<version>1.0.2-SNAPSHOT</version>

<scm>
<connection>scm:git:https://github.com/user/package.git</connection>
<developerConnection>scm:git:git@github.com:user/package.git</developerConnection>
<url>https://github.com/user/package</url>
<tag>HEAD</tag>
</scm>

<distributionManagement>
<repository>
<id>bintray-user-maven-package</id>
<name>user-maven-package</name>
<url>https://api.bintray.com/maven/user/maven/package</url>
</repository>
</distributionManagement>

<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<header>${basedir}/src/etc/header.txt</header>
<includes>
<include>src/main/java/**</include>
<include>src/test/java/**</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</build>

最佳答案

您必须发布您的 pom 才能了解您的 Maven 发布插件配置有什么问题。

还要考虑这一点:您可以使用 oss.jfrog.org host your snapshots并在推送到 Bintray 期间自动转换为版本。

  • 缺点 - 对于仅链接到 jcenter 的开源项目
  • 优势 - everything else :) 用于开发过程的免费 Artifactory 实例,与任何 CI 服务器(托管或云)集成,通过单个 REST API 调用透明发布到 Bintray。

关于java - 从 Maven 部署到 bintray 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22942435/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com