Simple maven deploy with credentials as arguments

If you don’t code day to day in some JVM language but you still need to use Maven for deploying artifacts from time to time, your best option is to use Maven docker image. However, credentials to your Maven repository are stored in .m2/settings.xml in your home folder which makes the standard Maven docker image harder to use.

If you just want to deploy an artifact, you can use image raget/maven-deployer.

docker pull raget/maven-deployer

It is pretty easy:

docker run -v <path_to_artefacts_folder>:/data mvn-deploy "<YOUR_REPO>"
 "-Drepo.login=<YOUR_USERNAME>" "-Drepo.pwd=<YOUR_PASSWORD>" "-Dfile=/data/"

Sometimes it is hard to remember all those parameters for maven deploy, so here it is:

docker run -v <path_to_artefacts_folder>:/data mvn-deploy "<YOUR_REPO>"
 "-Drepo.login=<YOUR_USERNAME>" "-Drepo.pwd=<YOUR_PASSWORD>"
 "" ""
 "-Dversion=" "-Dpackaging=zip" "-Dfile=/data/"
 "-DrepositoryId=company-releases" "-Durl="

Check out the code at and docker image at

Leave a Reply

Your email address will not be published. Required fields are marked *