gpt4 book ai didi

Maven : Build all dependencies but run tests on specific modules

转载 作者:行者123 更新时间:2023-12-03 14:45:31 25 4
gpt4 key购买 nike

以下是我的项目结构:

Master
|
|--A
|--B
|--C

C取决于A,B和Master。我想先编译 Master、A、B 然后 C 但运行仅存在于 C 模块中的测试。

我想要一个也可以在 Jenkins 中使用的命令。

我经历了 http://www.jayway.com/2013/06/09/working-efficiently-with-maven-modules/但使用

mvn -pl :C -am clean install



在所有模块中构建和运行测试:Master、A 和 B。

最佳答案

不可能使用单个命令为子模块运行不同的目标。

假设您有以下结构:

Parent
|
|---ModuleA
|---ModuleB (Depends on ModuleC)
|---ModuleC

现在如果你运行 mvn clean install -pl :ModuleB -am 来自 根 pom (Parent),你可以看到它构建了 Parent、ModuleC 和 ModuleB。

要么以不同的方式重新组织您的代码库,要么运行如下内容: mvn clean install -pl :ModuleB -Dmaven.test.skip=true && mvn test -pl :ModuleB

关于Maven : Build all dependencies but run tests on specific modules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25858904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com