jacoco.exec file is not generated after running jacoco maven 'prepare-agent' goal

30,790 views
Skip to first unread message

Nihar Kurapati

unread,
Oct 2, 2013, 4:18:38 PM10/2/13
to jac...@googlegroups.com

Hi,

I couldn't see any jacoco.exec file generated in 'target' folder after running "mvn jacoco:prepare-agent", but the build is success and during the build process I see message like below
"[INFO] argLine set to -javaagent:E:\workdir\unit\out\repository\org\jacoco\org.jacoco
.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=E:\workdir\unit\src\<project>\src\<package>\target\jacoco.exec"

But when I check at the location after the build is success, I don't see any .exec file in the specified location. 

Please help me out on resolving this issue. For reference please see my pom.xml below and I'm using GwtMockito for unit tests.
<plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.6.3.201306030806</version>
         <executions>
            <execution>
            <id>jacoco-initialize</id>
              <phase>initialize</phase>
  <goals>
<goal>prepare-agent</goal>
  </goals>
</execution>
<execution>
    <id>jacoco-site</id>
    <phase>verify</phase>
    <goals>
  <goal>report</goal>
    </goals>
</execution>
</executions>
</plugin>

Thanks,
Nihar

Henrik Horneber

unread,
Oct 3, 2013, 3:17:15 AM10/3/13
to jac...@googlegroups.com
Hi,

how do you start / run your unit tests?
Do you have any configuration for maven-surefire-plugin, for example something like <argLine>-XmX1024M</argLine>?
Do the tests run in the same VM you are attaching the jacoco agent to, or does the actual code run in a different VM?

regards,
Henrik




--
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 jacoco+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
"I find many of the machines of violence very attractive. Tanks, airplanes, warships, especially aircraft carriers."
- 14th Dalai Lama

Nihar Kurapati

unread,
Oct 3, 2013, 8:54:40 AM10/3/13
to jac...@googlegroups.com
Hi,

Thanks for your quick response. 
I usually run unit tests using mvn test command.
Please see below how is maven-surefire-plugin configured in pom.xml

<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.16</version>
      <dependencies>
          <dependency>
              <groupId>org.apache.maven.surefire</groupId>
              <artifactId>surefire-junit47</artifactId>
              <version>2.16</version>
          </dependency>
      </dependencies>
      <configuration>
          <argLine>-Xmx1024M</argLine>
      </configuration>
</plugin>

I'm not exactly sure, whether the tests run in the same VM or different VM. Please let me know how can I check that.

Thanks,
Nihar

Marc Hoffmann

unread,
Oct 3, 2013, 10:54:24 AM10/3/13
to jac...@googlegroups.com
Hi Nihar,

so you're overwriting the argLine property again. Try this one:

<argLine>-Xmx1024M ${argLine}</argLine>

Cheers,
-marc

On 2013-10-03 14:54, Nihar Kurapati wrote:
> Hi,
>
> Thanks for your quick response.
> I usually run unit tests using MVN TEST command.
>>> I couldn't see any JACOCO.EXEC file generated in 'target' folder
>>> after running "MVN JACOCO:PREPARE-AGENT", but the build is success
>>> and during the build process I see message like below
>>> "[INFO] ARGLINE SET TO
>>> -JAVAAGENT:E:WORKDIRUNITOUTREPOSITORYORGJACOCOORG.JACOCO
>>>
>>
> .AGENT0.6.3.201306030806ORG.JACOCO.AGENT-0.6.3.201306030806-RUNTIME.JAR=DESTFILE=E:WORKDIRUNITSRC<PROJECT>SRC<PACKAGE>TARGETJACOCO.EXEC"
>>>
>>>
>>> But when I check at the location after the build is success, I
>>> don't see any .exec file in the specified location.
>>>
>>> Please help me out on resolving this issue. For reference please
>>> see my pom.xml below and I'm using GWTMOCKITO for unit tests.
>>> [1].
>>
>> --
>> "I find many of the machines of violence very attractive. Tanks,
>> airplanes, warships, especially aircraft carriers."
>> - 14th Dalai Lama
>
> --
> 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 jacoco+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out [1].
>
>
> Links:
> ------
> [1] https://groups.google.com/groups/opt_out

Nihar Kurapati

unread,
Oct 3, 2013, 11:23:12 AM10/3/13
to jac...@googlegroups.com
Thanks for your response Marc.
I tried what you've suggested and it fails the build now with below error.

Error: Could not find or load main class ${argLine}

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-tes
t) on project <projectName>: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin
:2.16:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit
 called ?

Thanks,
Nihar

Marc Hoffmann

unread,
Oct 3, 2013, 12:05:06 PM10/3/13
to jac...@googlegroups.com
This is strange. If you check the build log: Has the argLine property
been set *before* the test execution?

Cheers,
-marc

On 2013-10-03 17:23, Nihar Kurapati wrote:
> Thanks for your response Marc.
> I tried what you've suggested and it fails the build now with below
> error.
>
> ERROR: COULD NOT FIND OR LOAD MAIN CLASS ${ARGLINE}
>> [1] [1].
>>>
>>>
>>> Links:
>>> ------
>>> [1] https://groups.google.com/groups/opt_out [1]

Nihar Kurapati

unread,
Oct 3, 2013, 12:15:13 PM10/3/13
to jac...@googlegroups.com
I don't think it is set before test execution. what it should be set to?

Thanks,
Nihar

Henrik Horneber

unread,
Oct 3, 2013, 2:59:53 PM10/3/13
to jac...@googlegroups.com

It gets set by jacoco. Your first mail contained the actual line.

It's hard to tell what is going on without seeing the complete pom.

For more options, visit https://groups.google.com/groups/opt_out.

Nihar Kurapati

unread,
Oct 3, 2013, 3:12:39 PM10/3/13
to jac...@googlegroups.com
Here is how my complete pom looks like.

<plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.6.3.201306030806</version>
         <executions>
            <execution>
            <id>jacoco-initialize</id>
              <phase>initialize</phase>
   <goals>
<goal>prepare-agent</goal>
   </goals>
</execution>
<execution>
    <id>jacoco-site</id>
    <phase>verify</phase>
    <goals>
  <goal>report</goal>
    </goals>
</execution>
</executions>
</plugin>
<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.16</version>
      <dependencies>
          <dependency>
              <groupId>org.apache.maven.surefire</groupId>
              <artifactId>surefire-junit47</artifactId>
              <version>2.16</version>
          </dependency>
      </dependencies>
      <configuration>
          <argLine>-Xmx1024M</argLine>
      </configuration>
</plugin>

Thanks for your help.

Nihar Kurapati

unread,
Oct 3, 2013, 3:46:57 PM10/3/13
to jac...@googlegroups.com
Hi,

It generates jacoco.exec file when I specify the java agent explicitly in surefire's <argLine> attribute, please see below

<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.16</version>
      <dependencies>
          <dependency>
              <groupId>org.apache.maven.surefire</groupId>
              <artifactId>surefire-junit47</artifactId>
              <version>2.16</version>
          </dependency>
      </dependencies>
      <configuration>
          <argLine>-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/0.6.3.201306030806/org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=${project.build.directory}\jacoco.exec</argLine>
      </configuration>
</plugin>

It seems like my problem is similar to the one posted in https://groups.google.com/forum/#!msg/jenkins-jacoco-plugin-mailing-list/4SwvdUwLNAg/ZzCrqQAD0nsJ. So, there is no other way to fix this problem?

In my case I'm  using GwtMockito (Mocking framework), not sure whether the above post applies to all mocking frameworks.

Please help me out. Appreciate your help.

Thanks,
Nihar

Henrik Horneber

unread,
Oct 5, 2013, 2:21:47 AM10/5/13
to jac...@googlegroups.com
Hi,

as I am not at work right not I can' tell for certain, but I'm pretty sure that your pom is exactly what my working ones look like, except for the argLine property.

Like this:
<!--- CHANGED HERE from what you sent -->
          <argLine>-Xmx1024M ${argLine}</argLine>
      </configuration>
</plugin>


... but you already tried that, since this is what Marc suggested, right?

Someone else recently sent an example on how to configure jacoco so it does not set argLine but a different property, using propertyName.

Ah, here https://groups.google.com/forum/#!topic/jacoco/09if-cdReGQ.

Might be worth another shot.

Nihar Kurapati

unread,
Oct 8, 2013, 11:10:25 AM10/8/13
to jac...@googlegroups.com
Hi,

Sorry for late reply. I've tried with propertyName also, still doesn't work. It only works when I explicitly mention java agent, and with this configuration rules doesn't seem like working.

Appreciate your help.

Thanks,
Nihar

Nihar Kurapati

unread,
Oct 10, 2013, 9:52:51 AM10/10/13
to jac...@googlegroups.com
FYI
I solved the issue without setting the java agent explicitly in surefire <argLine> tag. i.e.
Previously I've my jacoco plugin embedded inside pluginManagement tag, when moving it out of pluginManagement and keeping it inside plugins tag of maven it worked as expected with 'propertyName' approach :)

So, here is how my working pom looks like
<plugins>
    <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jaCoCoVersion}</version>
        <configuration>
         <dataFile>${jaCoCoExecutionDataFile}</dataFile>
        </configuration>
        <executions>
            <execution>
             <id>jacoco-initialize</id>
                   <phase>initialize</phase>
     <goals>
   <goal>prepare-agent</goal>
   </goals>
   <configuration>
                      <propertyName>jacoco.agent.argLine</propertyName>
                      <destFile>${jaCoCoExecutionDataFile}</destFile>
 </configuration>
</execution>
<execution>
 <id>jacoco-report</id>
   <phase>verify</phase>
   <goals>
   <goal>report</goal>
   </goals>
   </execution>
  </executions>
      </plugin>
</plugins>
<pluginManagement>
    <plugins>
        <plugin>          
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.16</version>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.surefire</groupId>
              <artifactId>surefire-junit47</artifactId>
              <version>2.16</version>
            </dependency>
          </dependencies>
          <configuration>            
<argLine>${jacoco.agent.argLine}</argLine>
          </configuration>
        </plugin>
      </plugins>
</pluginManagement>
Thanks a lot for your help. 

Henrik Horneber

unread,
Oct 10, 2013, 10:43:21 AM10/10/13
to jac...@googlegroups.com
Great! :)

vijaysi...@gmail.com

unread,
Sep 2, 2015, 12:37:50 PM9/2/15
to JaCoCo and EclEmma Users
On Thursday, October 10, 2013 at 8:13:21 PM UTC+5:30, Henrik Horneber wrote:
> Great! :)
> Hi

Vijay Singh

unread,
Sep 2, 2015, 12:52:18 PM9/2/15
to jac...@googlegroups.com
Hi There,

i have to generate the test coverage report for integration testing ,but while using jacoco i am getting below error

Skipping JaCoCo execution due to missing execution data file

i have a server code project in which i have written some services and another project in which i have written the integration test cases.so my integration test cases are hitting server code services and executing fine not able to generate the test coverage report as getting above error.

my doubt is  : how to  jacoco prepare agent get to know  for loading the classes from server project.

Please find attached pom.xml file




Thanks and regards,
Vijay Singh
Mob: 09632079548


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/LzmCezW8VKA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/4acb7dcd-783b-4db1-a328-cc516aa20d30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pom.xml

Evgeny Mandrikov

unread,
Sep 17, 2015, 7:03:24 PM9/17/15
to JaCoCo and EclEmma Users
Hi,

Please share Maven build log with "-X" option.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.

Vijay Singh

unread,
Sep 18, 2015, 2:14:35 PM9/18/15
to jac...@googlegroups.com

​​

could you write me the content to be mentioned in the pom file for capturing the test report code coverage...

 we have project which is having test cases for services deployed on the local tomcat or remote tomcat server(war file deployed on tomcat) so when i will execute the test cases these will hit the services and validates the test cases.

i am able to get the jacoco.exec file in the target folder of SampleExample project but site folder is not get created

Thanks and regards,
Vijay Singh
Mob: 09632079548


Hi,

To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.

--
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/LzmCezW8VKA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/5a4ab8a3-d452-4399-88d8-53595a8e99f6%40googlegroups.com.

Evgeny Mandrikov

unread,
Sep 19, 2015, 12:25:59 PM9/19/15
to JaCoCo and EclEmma Users
jacoco:report goal should be executed in order to generate report ( http://eclemma.org/jacoco/trunk/doc/report-mojo.html ), which is not happening according to your log, because it is not presented in your pom.xml
Hi,

To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.

--
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/LzmCezW8VKA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.

Vijay Singh

unread,
Sep 19, 2015, 2:00:27 PM9/19/15
to jac...@googlegroups.com
Hi Sir,

i have included the report goal and getting the report for code files which are present in the src/main/java package of project..not for the code files which are present in the war file deployed on the tomcat

Thanks and regards,
Vijay Singh
Mob: 09632079548


Hi,

To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.

--
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/LzmCezW8VKA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.

--
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/LzmCezW8VKA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/33429a1f-ce0c-43d9-9de1-e626cec8ba99%40googlegroups.com.
pom.xml

Vijay Singh

unread,
Sep 19, 2015, 2:02:10 PM9/19/15
to jac...@googlegroups.com
how do we get the report for the code files which are not in the same project from where we are executing the jacoco goals...like in case of integration test cases which are hitting the REST services deployed on the remote tomcat server..

Thanks and regards,
Vijay Singh
Mob: 09632079548


sushantg...@gmail.com

unread,
Oct 27, 2015, 6:58:59 AM10/27/15
to JaCoCo and EclEmma Users
how to attach agent to JVM
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages