I've been learning how to publish a Java library to jcenter. jcenter/bintray wants me to upload the following artifacts:
{groupId}/{artifactId}-{version}.jar
{groupId}/{artifactId}-{version}-sources.jar
{groupId}/{artifactId}-{version}-javadoc.jar
{groupId}/{artifactId}-{version}.pom
I can generate the first three no problem (binaries with a standard mvn package
and sources and javadoc using the plugins described here ).
Currently I'm just manually copying my pom.xml
to {groupId}/{artifactId}-{version}.pom
and that works fine, but it smells. I'm sure there must be an automated Maven way of doing this but I can't find it. Can anyone help?
You can upload your Maven project directly to Bintray just by adding some code to your pom.xml and then running the appropriate mvn
command :
First add a distribution section to your maven and specify the URL from which to distribute your project:
<distributionManagement>
<repository>
<id>bintray-repo-maven-example</id>
<url>https://api.bintray.com/maven/tamarjfrog/maven-repo/maven-example/;publish=1</url>
</repository>
</distributionManagement>
In order to work with Bintray you need to provide your Bintray username and API Key as upload credentials in the username and password tags of your Maven settings.xml file. The API Key can be found when editing your Bintray profile page:
<server>
<id>bintray-repo-maven-example</id>
<username>tamarjfrog</username>
<password>***my-top-secret-api-key***</password>
</server>
the you just run this simple command:
mvn deploy
The project will be built, uploaded to the the Bintray repository target URL you provided, and published. For more information take a look here .
mvn deploy
应该自动推送您的pom
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.