Skip to content

Instantly share code, notes, and snippets.

@jbaranski
Last active November 9, 2022 09:36
Show Gist options
  • Save jbaranski/b122231bcbb264ac0c7e to your computer and use it in GitHub Desktop.
Save jbaranski/b122231bcbb264ac0c7e 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
@kentoj
Copy link

kentoj commented Oct 16, 2017

Thank you! This worked when many other things had failed.

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