How can you deploy a specific artifact from Jenkins into Nexus?

后端 未结 4 2028
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 02:51

I have a multi-module maven project running in Jenkins. I would like to deploy the final artifact (an RPM from an assembly build) to the Nexus server. I see no reason to d

4条回答
  •  爱一瞬间的悲伤
    2020-12-02 03:15

    If you need still generic way.

    Use Execute shell option and use the mvn deploy command manually, You can pass your version and others things such as groupID etc as parameters in job, If you maintain separate job to build and upload this will work out.

    Ex:

    export M2_HOME=/PATH/TO/softwares/apache-maven-3.0.4 PATH=$M2_HOME/bin:$JAVA_HOME/bin:$PATH export PATH

    mvn -v

    mvn deploy:deploy-file -Durl=http://someorg:8081/nexus/content/repositories/t1.snapshot/ -DrepositoryId=t1.snapshot -DartifactId=artifactID -DgroupId=groupID -Dpackaging=zip -Dfile=${WORKSPACE}/filename.zip -Dversion=1.0-TEST-SNAPSHOT -s "/path/to/.m2/settings.xml"

提交回复
热议问题