[英]How to create a build pipeline for multi-module maven in Azure Devops
I have a multi-module maven project in azure repo:我在 azure repo 中有一个多模块 maven 项目:
Parent
----App
--POM.xml
----Core
--POM.xml
----API
--POM.xml
----ParentPOM.xml
When I tried to build App project in Azure, I am getting the following error: [ERROR] Failed to execute goal on the project: Could not resolve dependencies for project com.core:jar:1.0: Could not find artifact com.core:jar:1.0 in central ( https://repo.maven.apache.org/maven2 ).当我尝试在 Azure 中构建App项目时,出现以下错误:[错误] 无法在项目上执行目标:无法解析项目 com.core:jar:1.0 的依赖项:找不到工件 com.core: jar:1.0 在中央 ( https://repo.maven.apache.org/maven2 )。
So I tried to create multiple tasks in the same azure build to package for each module (App, Core, API) , which also gives the same result.所以我尝试在同一个 azure build 中创建多个任务来打包每个模块(App, Core, API) ,这也给出了相同的结果。 Could someone please help me on how to build the multi-module project and get the App jar file.有人可以帮助我了解如何构建多模块项目并获取App jar文件。
The way I've done it:我这样做的方式:
with this command: install -pl (module name) -am使用此命令: install -pl(模块名称)-am
where the module name should be one of the submodules.其中模块名称应该是子模块之一。 If you want to build all of them then only go with install如果你想构建所有这些,那么只需要安装
I have found the solution for the multi-module maven dependency issue, First We need to build the parent pom.xml, then build the submodules as per hierarchical order.我找到了maven多模块依赖问题的解决方案,首先我们需要构建父pom.xml,然后按照层次顺序构建子模块。 In between each module, add a task to copy and move the jar files to the staging directory.在每个模块之间,添加一个任务来复制 jar 文件并将其移动到暂存目录。 Here shared the image of my build steps.这里分享了我的构建步骤的图像。 Please take a look and comment on any questions.请查看并评论任何问题。
Please look into the DevOps configuration for reference请查看 DevOps 配置以供参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.