First add the following configuration in settings.xml
<server>
<id>thirdparty</id>
<username>root</username>
<password>root</password>
</server>
For example, if I need to upload the driver package of ojdbc to the private server, I need to execute the following command
mvn deploy:deploy-file
-DgroupId=ojdbc14 #groupId
-DartifactId=ojdbc14 #artifactId
-Dversion=10.2.0.3.0 包版本
-Dpackaging=jar #包类型
-Dfile=E:\ojdbc14.jar #需上传文件位置
-Durl=http://localhost:8080/nexus/content/repositories/thirdparty/ #仓库地址
-DrepositoryId=thirdparty #此选项与setting中配置的serverid 对应
Of course, you can also write another way to specify the configuration file, but the server account password must be configured in the setting.
mvn -s "D:maven\settings\settings.xml" deploy:deploy-file
-DgroupId=ojdbc14
-DartifactId=ojdbc14
-Dversion=10.2.0.3.0
-Dpackaging=jar
-Dfile=E:\ojdbc14.jar
-Durl=http://localhost:8080/nexus/content/repositories/thirdparty/
-DrepositoryId=thirdparty
If you have a large number of packages to upload, such as an outsourcing project, you need to upload the package to the customer's private server, you can sort out your own package and put it in a certain folder, and write a shell to do this.