Hi Marc, and thanks for your attention :)
I am trying to find a configuration of my project where when I run "mvn
test", I have test results and also the "jacoco.exec" report file generated.
To be honest, yes, after that, I will ask Sonarqube to integrate this
report, but for now there is no Sonarqube in the process.
Extract of my pom.xml :
...
<dependencies>
...
<dependency>
> <groupId>org.codehaus.sonar-plugins.java</groupId>
> <artifactId>sonar-jacoco-listeners</artifactId>
> <version>*2.2.1*</version>
> <scope>test</scope>
> </dependency>
> </dependencies>
...
> <plugin>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>2.17</version>
> <executions>
> <execution>
> <id>default-test</id>
> <phase>test</phase>
> <goals>
> <goal>test</goal>
> </goals>
> <configuration>
> <redirectTestOutputToFile>true</redirectTestOutputToFile>
> <reuseForks>false</reuseForks>
> <excludes>
> <exclude>**/com/mycom/xxx/test/jms/*</exclude>
> </excludes>
> <argLine>${jacoco.agent.ut.arg}</argLine>
> <properties>
> <property>
> <name>listener</name>
> <value>org.sonar.java.jacoco.JUnitListener</value>
> </property>
> </properties>
> </configuration>
> </execution>
> </executions>
> <configuration>
> <redirectTestOutputToFile>true</redirectTestOutputToFile>
> *<reuseForks>false</reuseForks>*
> <excludes>
> <exclude>**/com/mycom/etl/test/jms/*</exclude>
> </excludes>
> *<argLine>${jacoco.agent.ut.arg}</argLine>*
> <properties>
> <property>
> <name>listener</name>
> <value>org.sonar.java.jacoco.JUnitListener</value>
> </property>
> </properties>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.jacoco</groupId>
> <artifactId>jacoco-maven-plugin</artifactId>
> <version>*0.7.1.201405082137*</version>
> <executions>
> <execution>
> <id>prepare-ut-agent</id>
> <phase>process-test-classes</phase>
> <goals>
> <goal>prepare-agent</goal>
> </goals>
> <configuration>
>
> <destFile>/home/xxx/dev/src/kernel/04.02/fflayer/target/jacoco.exec</destFile>
> <propertyName>jacoco.agent.ut.arg</propertyName>
> <append>true</append>
> </configuration>
> </execution>
> <execution>
> <id>prepare-it-agent</id>
> <phase>pre-integration-test</phase>
> <goals>
> <goal>prepare-agent</goal>
> </goals>
> <configuration>
>
> <destFile>/home/xxx/dev/src/kernel/04.02/fflayer/target/jacoco-it.exec</destFile>
> <propertyName>jacoco.agent.it.arg</propertyName>
> <append>true</append>
> </configuration>
> </execution>
> </executions>
> </plugin>
Ends up with:
[INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 33.973s
> [INFO] Finished at: Mon Jun 23 14:45:37 CEST 2014
> [INFO] Final Memory: 22M/146M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on
> project xxx: Execution default-test of goal
> org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed:
> org.sonar.java.jacoco.JacocoController$JacocoControllerError: Unable to
> access JaCoCo Agent - make sure that you use JaCoCo and version not lower
> than 0.6.2. org/jacoco/agent/rt/RT: org.jacoco.agent.rt.RT -> [Help 1]
If I do the same, but deleting "reuseForks" option (ie getting back to
default "true")
[INFO] --- jacoco-maven-plugin:0.7.1.201405082137:prepare-agent
> (prepare-ut-agent) @ fflayer ---
> [INFO] jacoco.agent.ut.arg set to
> -javaagent:/home/xxx/.m2/repository/org/jacoco/org.jacoco.agent/0.7.1.201405082137/org.jacoco.agent-0.7.1.201405082137-runtime.jar=destfile=/home/gle_dromaguet/dev/src/kernel/04.02/fflayer/target/jacoco.exec,append=true
> [INFO]
> [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ fflayer ---
> [INFO] Surefire report directory:
> /home/gle_dromaguet/dev/src/kernel/04.02/fflayer/target/surefire-reports
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running dil.flatfile2.FlatFileSetNameProviderTest
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.122 sec
> - in dil.flatfile2.FlatFileSetNameProviderTest
> Running dil.flatfile2.FlatFileMappingTimePeriodTest
> Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.247 sec
> - in dil.flatfile2.FlatFileMappingTimePeriodTest
> ...
The Build is failed in the end because some of my JUnit are failed when
reusefork is set as true
but it looks like the coverage has been working correctly this time ad the
file "target/jacoco.exec" exists.
Do you have any idea what's going wrong ?
Regards,
2014-06-21 9:12 GMT+02:00 Marc R. Hoffmann <[email protected]>:
> Hi,
>
> - what exactly do you want to do (POM)?
> - what is the error message you see?
>
> Best regards,
> -marc
>
>
> On 20.06.14 16:51, [email protected] wrote:
>
>> Hi,
>>
>> I have the issue, but I don't get what would be the link with sonarqube ?
>> This error happens only with surefire and jacoco and nothing sonar
>> related...
>>
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jacoco/NlOKWfXD6sA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.