1.格式
mvn deploy:deploy-file -DgroupId=com.qiyi -DartifactId=sphinx -Dversion=1.0 -Dpackaging=jar -Dfile=D:sphinxapi.jar -Durl=[url] -DrepositoryId=[id
2.实例
D:developapache-maven-3.0.4in>mvn deploy:deploy-file -DgroupId=org.sphx -DartifactId=sphinxapi -Dversion=1.0 -Dpackaging=jar -Dfile=D:sphinxapi.jar
-Durl=http://10.10.10.10:8800/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty
DgroupId和DartifactId构成了该jar包在pom.xml的坐标,项目就是依靠这两个属性定位。自己起名字也行。
Dfile表示需要上传的jar包的绝对路径。
Durl私服上仓库的位置,打开nexus——>repositories菜单,可以看到该路径。
DrepositoryId服务器的表示id,在nexus的configuration可以看到。
上传成功后,在nexus界面点击3rd party仓库可以看到这包。
3.配置权限
$MAVEN/conf/settings.xml
<servers> <!-- server | Specifies the authentication information to use when connecting to a particular server, identified by | a unique name within the system (referred to by the 'id' attribute below). | | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are | used together. | --> <server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <!-- Another sample, using keys to authenticate. <server> <id>siteServer</id> <privateKey>/path/to/private/key</privateKey> <passphrase>optional; leave empty if not used.</passphrase> </server> --> </servers>
mvn install:install-file -Dfile=D:/soft/taobao-sdk/taobao-sdk-java-auto_1535979857702-20190712.jar -DgroupId=com.taobao -DartifactId=taobao-sdk-java-auto_1535979857702-20190712 -Dversion=20190712 -Dpackaging=jar
mvn install:install-file -Dfile=D:/soft/taobao-sdk/taobao-sdk-java-auto_1535979857702-20190712-source.jar -DgroupId=com.taobao -DartifactId=taobao-sdk-java-auto_1535979857702-20190712-source -Dversion=20190712 -Dpackaging=jar
上传到远程私服:
mvn deploy:deploy-file -DgroupId=com.taobao -DartifactId=taobao-sdk-java-auto_1535979857702-20190712-source -Dversion=20190712 -Dpackaging=jar -Dfile=D:/soft/taobao-sdk/taobao-sdk-java-auto_1535979857702-20190712-source.jar -Durl=http://122.224.191.90:8081/repository/maven-releases/ -DrepositoryId=releases
mvn deploy:deploy-file -Dfile=D:/soft/taobao-sdk/taobao-sdk-java-auto_1535979857702-20190712.jar -DgroupId=com.taobao -DartifactId=taobao-sdk-java-auto_1535979857702-20190712 -Dversion=20190712 -Dpackaging=jar -Durl=http://122.224.191.90:8081/repository/maven-releases/ -DrepositoryId=releases