Yeah!
it works! Thank you!

I anyway now have another problem: I want to use JaCoCo to find dead code, 
which I search by launching the full application in a simulated runtime 
environment (the Junit tests are testing also the dead code !!!)

But the application code is in a <dependency> and in this way I get only 
the report for the classes in src/main/java (also src/test/java are 
excluded from the report). How can I generate the report of coverage for 
dependencies?

Thanks!
Cristiano

PS. for further reference, I've configured my plugins in the pom in this 
way:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>${argLine}</argument>
<argument>-classpath</argument>
<classpath/>
<argument>net.cristcost.TestApplication</argument>
</arguments>
<classpathScope>test</classpathScope>
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
</plugin>

and I run and generate the report with this command:

mvn jacoco:prepare-agent exec:exec jacoco:report



PPS: it is important to use the exec:exec goal and not the exec:java (this 
last goal runs in the same VM of the mvn process so you don't get any 
chance to pas to the JVM the -javaagent argument!


Il giorno martedì 29 settembre 2015 13:19:44 UTC+2, Marc R. Hoffmann ha 
scritto:
>
> Hi Christiano, 
>
> JaCoCo's prepare agent goal can set any property with the agent 
> configuration: 
>
>    http://eclemma.org/jacoco/trunk/doc/prepare-agent-mojo.html 
>
> With this property you can configure the command line for java 
> execution. 
>
> Regards, 
> -marc 
>
>
>
> On 2015-09-28 22:55, Cristiano Costantini wrote: 
> > Hello all, 
> > is it possible to perform coverage of a static void main(String[] 
> > args) and generate an XML or HTML report directly from the maven 
> > plugin? 
> > 
> > I'm able to launch from Eclipse a generic java application with 
> > "Coverage as...", I've also been able to launch from the command line 
> > the -javaagent, and I've used the generated jacoco.exec in plugin, and 
> > from these two sessions I can generate the XML or HTML report. 
> > 
> > But I would like to automate the generation of the coverage report 
> > with my maven build: 
> > as far as I've seen, there is only documentation for performing the 
> > analysis during junit tests (suerefire plugin) or integration tests 
> > (failsafe plugin). 
> > 
> > Ideally, I would like launch the command "mvn exec:java ..." and I 
> > want to collect the coverage report of this execution. 
> > What am I missing? 
> > 
> > Thank you very much! 
> > Cristiano 
> > 
> >  -- 
> > 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] <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/jacoco/89fbda2b-f6e5-41b5-ae0d-9b970fffdbe9%40googlegroups.com
>  
> > [1]. 
> > For more options, visit https://groups.google.com/d/optout [2]. 
> > 
> > 
> > Links: 
> > ------ 
> > [1] 
> > 
> https://groups.google.com/d/msgid/jacoco/89fbda2b-f6e5-41b5-ae0d-9b970fffdbe9%40googlegroups.com?utm_medium=email&utm_source=footer
>  
> > [2] 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/c13cde9f-6537-4883-a1bc-f03a66704750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to