I'm using jacococ 0.8.7 version, maven 3.3.9 version, jDK 1.8 while I was running from Jenkins I'm facing below exception. what could be the issue? it worked when I used jacoco 0.7.4
command using in Jenkins:
-Dmaven.test.failure.ignore=true -U clean org.jacoco:jacoco-maven-plugin:0.8.7:prepare-agent org.jacoco:jacoco-maven-plugin:0.8.7:report test
Error
Execution default-cli of goal org.jacoco:jacoco-maven-plugin:0.8.7:prepare-agent failed: A required class was missing while executing org.jacoco:jacoco-maven-plugin:0.8.7:prepare-agent: org/jacoco/core/runtime/AgentOptions
pom.xml
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Related
I am trying to run some tests and generate a JaCoCo coverage report on a project and keep getting this error.
Here is my error log:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project empire-db: There are test failures.
[ERROR]
My plugins under the build section of the pom file are as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
I am using Java 15.0.2 and Maven 3.8.5
The project cleans and compiles just fine, I only encounter this issue when testing. Any input would be greatly appreciated!
When I run sonar my code coverage always coming 0. I am using clover. Below entry in pom.xml file
<properties>
<java.version>11</java.version>
<lombok.release>1.18.20</lombok.release>
<spring-cloud.version>Hoxton.SR11</spring-cloud.version>
<vigilphoenix-transformer-core.version>1.3-SNAPSHOT</vigilphoenix-transformer-core.version>
<clover.version>4.2.0</clover.version>
<sonar.java.coveragePlugin>clover</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.clover.reportPath>target\site\clover\clover.xml</sonar.clover.reportPath>
</properties>
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>${clover.version}</version>
<configuration>
<includesTestSourceRoots>false</includesTestSourceRoots>
<targetPercentage>0%</targetPercentage>
<debug>true</debug>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>setup</goal>
</goals>
</execution>
<execution>
<id>aggregate</id>
<phase>test</phase>
<goals>
<goal>clover</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<configuration>
<!--cloverDatabase>${project.build.directory}/target/clover/cloverMerge.db</cloverDatabase-->
<generateHtml>false</generateHtml>
<generatePdf>false</generatePdf>
<generateXml>true</generateXml>
<generateHistorical>false</generateHistorical>
</configuration>
</plugin>
When i run "mvn clean install" my clover.xml generate in "\target\site\clover\clover.xml"
Not sure what I have to do. if any one can help would be more help full.
You either need to configure the clover plugin which by default take that path or in your call for sonar from maven you can add it manually:
mvn sonar:sonar -Dsonar.clover.reportPath=\target\site\clover\clover.xml
I am able to integrate JaCoCo plugin and I can see the coverage report in Sonar 5.3 when I run
mvn sonar:sonar
but whereas when I run it from Jenkins it uploads the metrics to Sonar without the coverage report and displays this message
This component does not have coverage details.
Any ideas how to resolve this issue? Below is a snippet of my Sonar properties in pom.xml:
<properties>
<java.version>1.8</java.version>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.junit.reportsPath>${project.basedir}/target/surefire-reports</sonar.junit.reportsPath>
<sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
`
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<phase>process-resources</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
My Bamboo instance is using Maven version 3.3.3. But I keep getting this error
Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:2.0.3:jmeter (jmeter-tests) on project test: The plugin com.lazerycode.jmeter:jmeter-maven-plugin:2.0.3 requires Maven version 3.1.1
This is an extract from the pom.xml file
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<testFilesDirectory>${project.basedir}/src/test/jmeter</testFilesDirectory>
<ignoreResultFailures>true</ignoreResultFailures>
<testResultsTimestamp>false</testResultsTimestamp>
</configuration>
</plugin>
I'm trying to get pre and post integration phase to work with maven, to no avail.
My goal is to set up and tear down integration tests by running some binaries that are necessary. I'm testing with antrun-plugin and exec-plugin, but none of them prints the messages.
I'm running mvn verify. If I bind the plugins to clean phase and run mvn clean, the echo message and the ls are shown.
What's wrong? I'm using maven3
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12.3</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>ls</executable>
<arguments>
<argument>-la</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>xxx</id>
<configuration>
<target>
<echo>Cleaning deployed website</echo>
</target>
</configuration>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I helped someone else get the failsafe plugin configured correctly earlier. Try explicitly specifying the phases in the failsafe plugin executions. Not sure why that is needed, as the failsafe plugin docs say the goals are supposed to be bound to correct phases by default - but it seems to be.