在Azure Devops Maven构建管道中,构建多模块java项目时,构建成功。
但是,Jacoco代码覆盖率失败,并出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (default) on project VstsReport: An Ant BuildException has occured: Unable to read execution data file /vsts/agent/_work/8/s/CCReport43F6D5EF/jacoco.exec
2020-01-02T22:17:12.5100407Z [ERROR] around Ant part ...... @ 8:11 in /vsts/agent/_work/8/s/target/antrun/build-main.xml: /vsts/agent/_work/8/s/CCReport43F6D5EF/jacoco.exec (No such file or directory)Azure管道yml文件具有以下任务参数:
task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
goals: 'package'
options: '--settings settings.xml'
codeCoverageToolOption: JaCoCo
codeCoverageSourceDirectories: epubcheck-service/src/main,epubcheck-service/src/test
codeCoverageClassFilesDirectories: epubcheck-service/target/classes,epubcheck-service/target/test-classes
sonarQubeRunAnalysis: true如果我注释了codeCoverage参数,那么Maven构建任务将成功完成。只有当我在一个多模块项目中添加codeCoverage参数时,我才会得到上面提到的错误。
使用Azure DevOps管道构建Java maven build和Jacoco代码覆盖工具的人可以帮助我吗?
发布于 2020-02-26 03:07:39
在父项目的pom.xml中包含了jacoco-maven-plugin为我们解决了这个问题。下面是一段摘录:
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>https://stackoverflow.com/questions/59582337
复制相似问题