Jenkins : Add custom jar in maven project

纵然是瞬间 提交于 2019-12-24 19:24:50

问题


I am trying to add custom jar which is not available in Maven repository. When I am executing in local I am pointing to the Jar path, So no issues. But when I execute with Jenkins I am facing issue as Could not resolve dependencies for project. Also it list down the two Jar file missing which I added custom.

So help me how to add the custom Jar wile executing using Jenkins. Also I am using Nexus for binary storage. After Jenkins executes successfully the image file will be posted to the nexus directory with versioning.


回答1:


You have 2 options

1) If your have access to the local Nexus/Artifactory repo that your Jenkins uses you can add the jar to that repository and it will be downloaded as normal.

2) You can have a local repository where you check the jar into SCM under your project. You would then access it like this in your pom. See http://doduck.com/adding-local-jar-in-maven-local-repository/

   <repositories>
      <repository>
         <id>localrepository</id>
         <url>file://${basedir}/repo</url>
      </repository>
   </repositories>


来源:https://stackoverflow.com/questions/44583836/jenkins-add-custom-jar-in-maven-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!