I\'m aware I can add maven repositories for fetching dependencies in ~/.m2/settings.xml. But is it possible to add a repository using command line, something like:
I am not sure if you can do it using the command line. You can on the other hand add repositories in the pom.xml as in the following example. Using this approach you do not need to change the ~/.m2/settings.xml file.
...
MavenCentral
Maven repository
http://repo1.maven.org/maven2
true
false
...
Codehaus Snapshots
http://snapshots.repository.codehaus.org/
true
false
...
apache.snapshots
Apache Snapshot Repository
http://people.apache.org/repo/m2-snapshot-repository
false
Codehaus Snapshots
http://snapshots.repository.codehaus.org/
true
false
...