I've set up the maven build for a Java project according to Publishing releases using Github, Bintray and maven-release-plugin , a blog post by Andreas Veithen.
My pom
version is 1.0.2-SNAPSHOT, and I've created the respective version 1.0.2
in my bintray package. I perform mvn -Prelease clean install
, no problems. I perform mvn release:prepare
, no problems. But when I perform mvn release:perform
, the build breaks with the error message below.
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]
I'm noticing that the release plugin is trying to upload the SNAPSHOT, and of course this should have no place on bintray... I'd have thought that it would try to deploy 1.0.2? How can I convince maven to upload the correct artifact, or is there anything wrong with my set up?
Below are the parts of the POM that I think are relevant, the complete POM is at 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>