Skip to content

Instantly share code, notes, and snippets.

@cccaternberg
Forked from jbaranski/nexus_upload.sh
Created October 11, 2018 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cccaternberg/ff25c4a39c9f0ff874def6541b3229e8 to your computer and use it in GitHub Desktop.
Save cccaternberg/ff25c4a39c9f0ff874def6541b3229e8 to your computer and use it in GitHub Desktop.
Artifact upload to nexus using curl
# nexus 2.x
# Assuming you run this command against the directory the jar sits in
#
# r - repository
# hasPom - whether you are supplying the pom or you want one generated. If generated g, a, v, p, and c are not needed
# e - extension
# g - group id
# a - artifact id
# v - version
# p - packaging
# c - classifier (optional, not shown in examples above)
# file - the file(s) to be uploaded. These need to come last, and if there is a pom file it should come before the artifact
curl -v -F r=yourrepo -F hasPom=false -F e=jar -F g=yourgroup -F a=yourartifact -F v=yourversion -F c=yourclassifier -F p=jar -F file=@./your-jar-file-1.0.jar -u admin:admin123 http://192.168.99.100:32768/service/local/artifact/maven/content
# nexus 3.x
# in settings.xml
#<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
# xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
# xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
# https://maven.apache.org/xsd/settings-1.0.0.xsd">
# <servers>
# <!--your existing servers are here if any-->
# <server>
# <id>nexus</id>
# <username>admin</username>
# <password>admin123</password>
# </server>
# </servers>
#</settings>
mvn deploy:deploy-file -DgroupId=eam -DartifactId=ant-contrib -Dversion=1.0b3 -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nexus -Durl=http://localhost:8081/repository/thirdparty -Dfile=ant-contrib-1.0b3.jar
@cccaternberg
Copy link
Author

curl -v -u :
--upload-file artifact.zip
https:///repository/maven-releases/com/example/artifact/1.0.0/artifact-1.0.0.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment