Hi, if you're new with this I definitely recommend not to write your own integration with JaCoCo. There are out-of-the-box integrations for Maven, Ant and Gradle. Also for report generation. There is no need to use the JaCoCo API at all. There are thousands of projects out there which use these standard tools.
Regards, -marc On 2017-04-06 12:12, Ondrej Zoricak wrote: > Thank you for your suggestion. Because I am new with Jacoco and Javaagent I > needed couple of hours to find out how Javaagent works and how it is working > with Jacocoagent(and what is this Jacocoagent). I made research and I think I > have two options: > > 1. I find out that it is little bit difficult to provide solutions for > external projects because I will need Javaagent connected to some > server(glassfish, tomcat) and run javaagent with jacocoagent and with > pertaining project and then It will generate *.exec file and I will need use > Jacoco API to parse data... Am I right? > > 2. So I think it will be easier find out which kind(maven, and, gradle) of > external project is it. Then modify build and add Jacoco plugin and generate > *.exec file and then just parse this file with Jacoco API... Am I right? > > Please give me some clue which one solution is better(so will easier to > implement, will go to a less troubles and will cover wide scale of programs). > > > Thank you again Marc. > > On Wednesday, 5 April 2017 14:34:07 UTC+2, Marc R. Hoffmann wrote: > > Hi, > > well, if you want to write everything yourself, here are the steps: > > * Launch your external program with the JaCoCo agent > (http://www.jacoco.org/jacoco/trunk/doc/agent.html) [1] > * After program terminates create a report (example > http://www.jacoco.org/jacoco/trunk/doc/examples/java/ReportGenerator.java > [2]). For this you need the *.exec file created by the agent, the class files > of your application (JARs will also do the job) and the Java source files if > you want syntax highlighting. > > Regards, > -marc > > On 2017-04-05 13:20, Ondrej Zoricak wrote: > These solutions will provide code coverage for my program but I want to > create program which will create code coverage for external programs... Like > I will run my program then will set project directory of some external > program and my program will show code coverage information... so user will > have result with zero effort and dependency on IDE... So I want to know if is > there some way to use Jacoco API provide these features and if yes what is > prerequisite do so. > > Thank you again. > > On Wednesday, 5 April 2017 10:50:24 UTC+2, Marc R. Hoffmann wrote: > > Hallo Ondrej, > > there is a couple of out-of-the-box solutions to do this: > > * Launch your program within Eclipse in coverage mode (using the EclEmma code > coverage plug-in http://www.eclemma.org/) > * Launch your program with a Maven build (using JaCoCo maven plugin > http://www.jacoco.org/jacoco/trunk/doc/maven.html [3]) > * Launch your program with a Ant build (using the JaCoCo Ant tasks > http://www.jacoco.org/jacoco/trunk/doc/ant.html [4]) > * Use any other integration of JaCoCo > (http://www.jacoco.org/jacoco/trunk/doc/integrations.html [5]) > > Regards, > -marc > > On 2017-04-03 19:25, Ondrej Zoricak wrote: > Hello guys. > > I read documentations and I find some examples but I didn't find any example > how to write code coverage program using Jacoco API. I need just number of > lines which are executed when some external program is running so I expected > that my program should build and run this external project and give me some > result... but do I need Jacoco plugin for this or how is it working? Thank > you for any help. Links: ------ [1] http://www.jacoco.org/jacoco/trunk/doc/agent.html) [2] http://www.jacoco.org/jacoco/trunk/doc/examples/java/ReportGenerator.java [3] http://www.jacoco.org/jacoco/trunk/doc/maven.html [4] http://www.jacoco.org/jacoco/trunk/doc/ant.html [5] http://www.jacoco.org/jacoco/trunk/doc/integrations.html -- 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/29d22d9b40bc8da4700ab703befc5c88%40mountainminds.com. For more options, visit https://groups.google.com/d/optout.
