Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save laszlomiklosik/6792336 to your computer and use it in GitHub Desktop.
Save laszlomiklosik/6792336 to your computer and use it in GitHub Desktop.
Upload artifact to protected Maven group repository
# Precondition: you must have the credentials for serverId thirdparty defined in your settings.xml file like this:
#
# <servers>
# <server>
# <id>thirdparty</id>
# <username>your_username_goes_here</username>
# <password>your_password_goes_here</password>
# </server>
# ...
# </servers>
# Note: if you receive 401, you do not have enough rights in the group repository (Nexus, Artifactory - whichever you use)
# option 1: with generated POM
mvn deploy:deploy-file -Dfile=your_file.jar -Durl=http://your_maven_repo_host/content/repositories/thirdparty -DrepositoryId=thirdparty -DgroupId=desired.group.id -DartifactId=desire4dArtifactId -Dversion=desiredVersion -Dpackaging=jar -DgeneratePom=true
# option 2: also upload existing POM
mvn deploy:deploy-file -Dfile=your_file.jar -Durl=http://your_maven_repo_host/content/repositories/thirdparty -DrepositoryId=thirdparty -Dpackaging=jar -DgeneratePom=false -DpomFile=your_pom.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment