简体   繁体   English

如何在 Jenkins 中添加依赖 JARs 以构建 Maven 项目?

[英]How to add dependency JARs for building Maven project in Jenkins?

My Maven project uses two dependency JARs which I built in my local environment.我的 Maven 项目使用我在本地环境中构建的两个依赖项 JARs。 When I build the Maven project (clean install), it is failing.当我构建 Maven 项目(全新安装)时,它失败了。 It is unable to find those two JARs.找不到这两个 JARs。

How do I add those two JARs?如何添加这两个 JARs?

Those jars are there in my user account's.m2 folder.那些 jars 在我的用户帐户的.m2 文件夹中。 Build is running fine when done from eclipse.从 eclipse 完成构建运行良好。

If you run a Jenkins server in your company, it would be good to also run a Nexus or Artifatory server that manages your Java artifacts (external and internal ones).如果您在公司中运行 Jenkins 服务器,最好也运行管理 Java 工件(外部和内部的)的 Nexus 或 Artifatory 服务器。 First build your dependencies on Jenkins an deploy them to your repository.首先在 Jenkins 上构建您的依赖项并将它们部署到您的存储库。 When Jenkins builds the other artifact, it can then draw the dependencies from your Nexus/Artifactory.当 Jenkins 构建另一个工件时,它可以从您的 Nexus/Artifactory 中提取依赖项。

You could also use the Jenkins local repository for that, but in the long run it is better to have a proper Maven repository.您也可以为此使用 Jenkins 本地存储库,但从长远来看,最好有一个合适的 Maven 存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM