由于 Github 禁用了下载,我们需要使用新服务(如 Bintray.com)来发布我们的二进制文件。对于我们的用例,我需要构建一个包(使用 appassembler-maven-plugin),然后 zip 和 tar.gz 这个构建并将其部署到 bintray。
如果每晚构建将由 travis 发布并使用 mvn 发布插件手动发布,那就太好了。
目前 pom 看起来像这样:
<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>myproject</groupId>
<artifactId>myproject</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<scm>
<url>https://github.com/d0x/fromGithubToBintray</url>
<connection>scm:git:git://github.com/d0x/fromGithubToBintray.git</connection>
<developerConnection>scm:git:git@github.com:d0x/fromGithubToBintray.git</developerConnection>
</scm>
<developers>
<developer>
<name>Christian Schneider</name>
<url>https://github.com/d0x</url>
<id>d0x</id>
</developer>
</developers>
<!-- <distributionManagement> -->
<!-- <repository> -->
<!-- <id>bintray</id> -->
<!-- <url>https://api.bintray.com/maven/d0x/fromGithubToBintray/downloads</url> -->
<!-- </repository> -->
<!-- </distributionManagement> -->
<properties>
<mainClass>fromGithubToBintray.Main</mainClass>
<java-version>1.7</java-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<!-- ... -->
</dependencies>
<build>
<plugins>
<!-- To build a clean binary pacakge to distribute -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<programs>
<program>
<mainClass>${mainClass}</mainClass>
<name>fromGithubToBintray</name>
</program>
</programs>
<extraJvmArguments>-Djava.awt.headless=true</extraJvmArguments>
</configuration>
</plugin>
<!-- To specify the Java Version -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</build>
</project>
如何调整 pom 文件来做到这一点?
复制:
我把小例子上传到了github:https ://github.com/d0x/fromGithubToBintray
要执行它,请执行以下操作:
- git 克隆https://github.com/d0x/fromGithubToBintray.git
- cd from GithubToBintray
- mvn clean package appassembler:assemble
- chmod +x 目标/appassembler/bin/fromGithubToBintray
- ./target/appassembler/bin/fromGithubToBintray
这应该打印You did it!
。现在的目标是上传 compress 并将这个 appassembler 文件夹上传到 bintray。
做过的研究: