安装构建工件而不再次运行构建
我的 Jenkins 构建之一有一个相当复杂的构建工作流程。该项目包含两个模块。模块 M1 构建服务,模块 M2 构建服务客户端。 M1 依赖于 M2(不要问我为什么)。 M2 需要从 M1 中的 ejb 创建存根。因此,我们处于循环依赖关系中,我试图通过以下构建顺序来规避它。
- mvn clean install(对于整个项目)
- mvn package -PCI(用于带有配置文件的 M2,用于收集所有依赖项,包括 M1 jar)
- 将构建工件和依赖项复制到不同的计算机以创建存根
- 创建存根
- 版本覆盖 M2 构建工件
- 使用包含存根mvn 的 install:install (对于 M2)
运行最终安装时,它会爆炸:
[INFO] [install:install {execution: default-cli}]
[信息] ---------------------------------------------------------- --------------------------
[错误] 构建错误
[信息] ---------------------------------------------------------- ----------------------------------
[信息] 此项目的打包未将文件分配给构建工件
[信息] ---------------------------------------------------------- -------------------------
所以我想出了这个想法,因为我已经使用了 Jenkins 并且我无论如何都要部署到我们的快照目录,所以我不用担心,我可以省略本地部署,因为它无论如何都会从快照存储库中提取较新的版本。结果是,Jenkins 在运行安装后归档了该作业的工件。由于我没有运行最终安装,因此部署了没有存根的版本(我相信是从步骤 2 开始的)。
然后,我配置了 Jenkins 作业,除了 Maven 集成的自动归档功能之外,还使用构建后选项显式归档我的服务客户端 jar。结果是,我为 Jenkins 工作归档了服务客户端 jar。一种是项目级别(带有存根的所需版本),另一种是 M2(不带存根)。当然,部署了没有存根的版本。
知道如何在不改变项目结构的情况下摆脱这个困境吗?只要开发人员的愿望仍然得到满足,我就可以向 pom 文件添加内容。 Jenkins 的工作是我的领域。
I have a fairly complicated build workflow for one of my Jenkins builds. The project contains two modules. Module M1 builds a service and module M2 builds the service client. M1 is dependent on M2 (don't ask me why). M2 needs stubs created from the ejb's in M1. So we are at an circular dependency which I tried to circumvent with following build order.
- mvn clean install (for the whole project)
- mvn package -PCI (for M2 with profile to gather all dependencies incl. M1 jar)
- copy build artifacts and dependencies to different machine for stub creation
- create stubs
- overwrite M2 build artifact with version that contains stubs
- mvn install:install (for M2)
when running the final install, it bombs with:
[INFO] [install:install {execution: default-cli}]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The packaging for this project did not assign a file to the build artifact
[INFO] ------------------------------------------------------------------------
So I came up with the idea, that since I already use Jenkins and I am deploying anyway to our snapshot directory, I have nothing to worry and I can leave out the local deployment since it will pull the newer version from the snapshot repo anyway. The result was, that Jenkins archives the artifact for the job after it ran the install. Since I didn't run the final install, the version without stubs was deployed (from step 2 I believe).
Then, I configured the Jenkins job to explicitly archive my service client jar with the post build option in addition to the automatic archiving feature of the maven integration. The result was, that I had the service client jars archived for the Jenkins job. One was one the Project level (the desired version with stubs) and one on M2 (w/o stubs). Of course the version without stubs was deployed.
Any idea how I can get out of this dilemma, without changing the project structure. I can add stuff to the pom files as long as the developer desires are still fulfilled. The Jenkins job is my domain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来你需要重新组织一下。是否可以将客户端中的服务器->客户端依赖关系分解到一个单独的jar中,并将对客户端的依赖关系更改为对这个新jar的依赖关系?
It sounds like you need to reorganize. Is it possible to factor out the server->client dependencies in the client into a separate jar, and change the dependency on the client to a dependency on this new jar?