配置settings.xml
因為nexus是需要登陸操作,當然可以通過配置免登陸
<server>
<id>Snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
有源碼的情況,mvn:deploy 可以直接将代碼釋出到倉庫
cmd輸入指令
mvn deploy:deploy-file -DgroupId=com.xx.yy.log -DartifactId=xx-log-client -Dversion=4.0-SNAPSHOT -Dpackaging=jar -Dfile=E:\xx-log-client-4.0-SNAPSHOT.jar -Durl=http://127.0.0.1:8080/nexus/content/repositories/snapshots/ -DrepositoryId=Snapshots
DgroupId和DartifactId構成了該jar包在pom.xml的坐标
Dfile表示需要上傳的jar包的絕對路徑。
Durl私服上倉庫的位置,打開nexus——>repositories菜單,可以看到該路徑。
DrepositoryId伺服器的表示id,在nexus的configuration可以看到。
Dversion表示版本資訊
上傳成功後,在nexus界面點選 -DrepositoryId=Snapshots 對應的倉庫可以看到這包。