Is it possible to pass a password in Maven Deploy in the command line?

The settings.xml is considered personal, so for that reason the username+password are stored in the (user-)settings.xml. So in general there's no reason to pass them as argument. (btw, passwords can be stored encrypted here) The maven-deploy-plugin has no option to pass them via commandline. However, I've seen hacks like:

<username>${internal.repo.username}</username>

And now you can do -Dinternal.repo.username=someUser


This also works:

<server>
  <id>${repo.id}</id>
  <username>${repo.username}</username>
  <password>${repo.password}</password>
</server>

I'll lay out here the full solution, but basically Robert Scholte's solution works brilliant.

In your ~/.m2/settings.xml you should have the following

<settings>
    <servers>
        <server>
            <id>${repo.id}</id>
            <username>${repo.login}</username>
            <password>${repo.pwd}</password>
        </server>
    </servers>
</settings>  

and then you just

mvn -Drepo.id=myRepo -Drepo.login=someUser -Drepo.pwd=somePassword clean install

You can even use your environment variable (if you are doing that on the remote server/container, for example):

mvn -Drepo.id=$REPO_ID -Drepo.login=$REPO_LOGIN -Drepo.pwd=$REPO_PWD clean install