【发布时间】:2014-05-29 06:45:08
【问题描述】:
上次我决定在我的 Maven 构建的 Java 项目中将 Cobertura 插件替换为 JaCoCo 插件。
其中一个是具有模块间依赖关系的多模块项目:
*-- pl.chilldev.commons
|-- commons-concurrent
|-- commons-daemon
`-- commons-exception
问题是commons-daemon 依赖于commons-exception。
我有jacoco-maven-plugin 配置如下:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.1.201405082137</version>
<executions>
<execution>
<id>jacoco-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
一切正常,测试运行,但 site 目标失败:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project commons: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin: Failed to execute goal on project commons-daemon: Could not resolve dependencies for project pl.chilldev.commons:commons-daemon:jar:0.0.3-SNAPSHOT: Could not find artifact pl.chilldev.commons:commons-exception:jar:0.0.3-SNAPSHOT -> [Help 1]
如果没有jacoco-maven-plugin,即使site 目标也一切正常。
【问题讨论】:
-
你是在运行
mvn install还是mvn package -
我写得很清楚,它适用于目标
site。