要上传jar包的依赖:
<dependency>
<groupId>com.sitech.ddoegroupId>
<artifactId>ddoe-client-allartifactId>
<version>0.0.1-SNAPSHOTversion>
<classifier>jar-with-dependenciesclassifier>
dependency>
第一步:
到maven的安装路径/conf下找到setting.xml,在
<server>
<id>CRM_BCC_RELEASEid>
<username>crm_bccusername>
<password>crm_bccpassword>
server>
<server>
<id>CRM_BCC_SNAPSHOTSid>
<username>crm_bccusername>
<password>crm_bccpassword>
server>
RELEASE:存放稳定版本
SNAPSHOTS:快照,不稳定状态,可以替换成新的版本
第二步:
DOS命令行 mvn deploy
mvn deploy:deploy-file
-DgroupId=com.sitech.ddoe
-DartifactId=ddoe-client-all
-Dversion=0.0.1-SNAPSHOT
-Dclassifier=jar-with-dependencies
-Dpackaging=jar
-Dfile=要上传jar包的磁盘路径
-Durl=http://私服路径/nexus/content/repositories/CRM_BCC_Snapshot/
-DrepositoryId=CRM_BCC_SNAPSHOTS 这里的DrepositoryId应该和setting.xml中的serverId保持一致
如果是用eclipse中执行
需要在项目的pom.xml,在
<distributionManagement>
<snapshotRepository>
<id>CRM_BCC_SNAPSHOTSid>
<name>CRM_BCC Snapshot Repositoryname>
<url>私服路径/CRM_BCC_Snapshot/url>
snapshotRepository>
<repository>
<id>CRM_BCC_RELEASEid>
<name>CRM_BCC Release Repositoryname>
<url>私服路径/CRM_BCC_Release/url>
repository>
distributionManagement>
然后找到mvn bulid,新建一个标签页,在Goals上填写deploy
但是更推荐DOS命令行的方式,因为可选信息比较多。
上传中遇到的错误:
1.用mvn bulid把命令行全部粘到Goals执行报错
Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal in the format : or : [: ]: . Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
错误原因是eclipse中的mvn命令会自动帮你加上mvn,如果你填的是mvn install,就会变成mvn mvn install。所以去掉mvn即可。
2.用同样的方式上传realse,报错
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts:
Could not transfer artifact com.sitech.ddoe:ddoe-client-all:jar:jar-with-depend
encies:0.0.1-20180605.070224-1 from/to CRM_BCC_RELEASE (path/nexus/content/repositories/CRM_BCC_Release/): Failed to transfer file: path/nexus/content/repositories/CRM_BCC_Release/com/sitech/ddoe/
ddoe-client-all/0.0.1-SNAPSHOT/ddoe-client-all-0.0.1-20180605.070224-1-jar-with-
dependencies.jar. Return code is: 400, ReasonPhrase: Bad Request. -> [Help 1]
Snapshot可以发布,但是releases却发布不了,可能是