Maven Jar File Deployment in Sonatype Nexus


1. Create settings xml file in the ${user.home}/.m2 directory if not exists

2. Add following server config as follows:

<settings xmlns=""

You can use any id name as server id attribute.

3. Run following command in cmd:

mvn deploy:deploy-file -Durl=http://localhost:9090/repository/maven-releases \ 
-DrepositoryId=codesenior-local \ 
-DgroupId=com.codesenior.telif \ 
-DartifactId=generic-dao-service \ 
-Dversion=1.0.0-SNAPSHOT \ 
-Dpackaging=jar \ 
-Dfile=generic-dao-service-1.0.0-SNAPSHOT.jar \ 

Note: If you got an error while running above script please select new version instead of 1.0.0-SNAPSHOT, such as 1.0.1-SNAPSHOT.

Note: If you add -SNAPSHOT suffix to -Dversion, you have to choose Version policy as Snapshot as follows:


Note: When uploading snapshot, maven deploy plugin automatically adds suffix timestamp to the version number. If you want to disable it, you can set uniqueVersion parameter to false. This parameter is removed in Maven 3, so only works in Maven 2. Whether timestamp is added or removed, there is no difference to download. You can always add dependency without timestamp suffix. For more information please click

© 2019 All rights reserved. Codesenior.COM