jacob
jacob

Reputation: 2896

How to publish jar as maven artifact to bintray using curl?

I have some 3rd party jar files that I want to upload to bintray, and then be able to import them as maven artifacts. I wrote a bash script similar to this one:

https://github.com/bintray/bintray-examples/blob/master/bash-example/pushToBintray.sh

At first, I tried uploaded the jar file as content, but bintray doesn't treat is as a maven artifact, and I can't include it as a dependency using sbt.

So I then tried doing a maven upload instead, in order to try to make bintray treat it like a maven artifact. My curl command looks like this:

${CURL} -T ${file} ${API}/maven/${BINTRAY_USER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_NAME}-${PCK_VERSION}.jar/;publish=1

The http response is:

{"message":"Provided artifact path does not comply with Maven's convention"}

I also tried variants of the curl command, particularly different values for the file_path token in the url. But all have the same result.

How do I get this to work?

Upvotes: 0

Views: 1107

Answers (1)

jacob
jacob

Reputation: 2896

I figured it out. It seems that mvn is a better approach than curl:

        mvn deploy:deploy-file -Durl="https://api.bintray.com/maven/${USER_ID}/${REPO_ID}/${PCK_NAME}/;publish=1" \
                       -DrepositoryId=${SERVER_ID} \
                       -Dfile=${file} \
                       -DgroupId=${GROUP_ID} \
                       -DartifactId=${PCK_NAME} \
                       -Dversion=${PCK_VERSION} \
                       -Dpackaging=jar \
                       -DgeneratePom=true \
                       --settings ${DIR}/settings.xml

Upvotes: 1

Related Questions