我有一个具有以下模式的多模块maven项目
root
- module-A
- module-B (depends on A)
- module-C1 (depends on B)
- module-C2 (depends on B)
...
- module-Cn (depends on B)它的scoverage maven-plugin配置如下。
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<aggregate>true</aggregate>
</configuration>
<executions>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>scoverage.plugin.version = 1.4.1 scala.version = 2.11.11
如果我从根项目在本地午餐mvn clean package,它会按预期工作,但在CI工作流(竹子,如果有用)中,模块A和B运行得很好,但在C1上,我得到以下错误:
14-May-2020 14:23:41 [INFO] >>> scoverage-maven-plugin:1.4.1:report (report) > [scoverage]test @ C1 >>>
14-May-2020 14:23:41 [INFO]
14-May-2020 14:23:41 [INFO] --- scoverage-maven-plugin:1.4.1:pre-compile (report) @ C1 ---
14-May-2020 14:23:41 [INFO] Downloading from nexus: https://fakenexusurl.com/repository/all/module-B/1.0.0-SNAPSHOT/maven-metadata.xml
14-May-2020 14:23:41 [INFO] Downloading from nexus: https://fakenexusurl.com/repository/all/module-B/1.0.0-SNAPSHOT/module-B-1.0.0-SNAPSHOT.jar
14-May-2020 14:23:41 [INFO] ------------------------------------------------------------------------
14-May-2020 14:23:41 [INFO] Reactor Summary:
14-May-2020 14:23:41 [INFO]
14-May-2020 14:23:41 [INFO] root .......................................... SUCCESS [ 3.610 s]
14-May-2020 14:23:41 [INFO] module-A ................................... SUCCESS [01:38 min]
14-May-2020 14:23:41 [INFO] modulde-B ............................. SUCCESS [01:30 min]
14-May-2020 14:23:41 [INFO] module-C1 ........................... FAILURE [01:37 min]
14-May-2020 14:23:41 [INFO] module-C2 ........................... SKIPPED
14-May-2020 14:23:41 [INFO] ------------------------------------------------------------------------
14-May-2020 14:23:41 [INFO] BUILD FAILURE
14-May-2020 14:23:41 [INFO] ------------------------------------------------------------------------
14-May-2020 14:23:41 [INFO] Total time: 04:50 min
14-May-2020 14:23:41 [INFO] Finished at: 2020-05-14T14:23:41Z
14-May-2020 14:23:42 [INFO] Final Memory: 85M/1627M
14-May-2020 14:23:42 [INFO] ------------------------------------------------------------------------
14-May-2020 14:23:42 [ERROR] Failed to execute goal on project module-C1: Could not resolve dependencies for project group:module-C1:jar:1.0.0-SNAPSHOT: Could not find artifact group:module-B:jar:1.0.0-SNAPSHOT in nexus (https://fakenexusurl.com/repository/all/) -> [Help 1]我看到它试图从公司的网络节点下载模块B,当然,它不在那里,因为我们没有发布这个快照。但我不明白为什么它要尝试下载应该在同一项目的另一个模块中查看的依赖项。以及为什么它不能对依赖于A的B执行相同的操作,如果除了模块名称和依赖项之外,文件是相等的。
使用的所有依赖项都在根dependencyManagment中声明,插件在pluginManagment中声明
CI工作流程对我们来说是一个黑匣子,我们不知道他们是否在使用任何额外的配置文件。我们唯一知道的是启动mvn clean package命令。
发布于 2020-05-20 16:25:12
scoverage流创建了maven流的分支,并重新运行所有内容,直到进行测试。在这个fork中,没有很好地管理模块之间的依赖关系,所以从干净的执行中正确执行它的唯一方法是使用命令:
mvn clean install scoverage:report将install更改为package、deploy或任何需要报表的元素。这将强制maven在每个模块的末尾执行scoverage:report,从而防止不必要的行为。
在this thread中找到了这些信息。
https://stackoverflow.com/questions/61869502
复制相似问题