Hi JK, The answer is YES, but you will not get a meaningful report. Assume in your application you have just accessed login page and assume LoginPage.java is executed, along with that some more java src consumed from LoginPage.java, so once .class files generated you will be able to generate the report without using the java source code of your project but .class & source mapping will not happen meant which code snippet is consumed (green highlighted) and which part is not even accessed or executed means may be dead code (red highlighted).
ultimately without the source, you will not be able to find dead code/un accessed code from your source code files for which you are using jacoco. Thanks, Jiten On Monday, March 4, 2019 at 8:19:12 PM UTC+5:30, jk wrote: > > Hi Jiten, > > Thanks for your reply. > > One question : sourcefiles parameter is that the location of the .java > files? > > I’m asking as I don’t have the access to the product code. Is it possible > to generate the report for. Just the class files using —classfiles. > > Thanks, > Jk. > > > > On Sunday, March 3, 2019, 'Jitendra Kumar' via JaCoCo and EclEmma Users < > [email protected] <javascript:>> wrote: > >> Hi JK, >> >> pre-requsites: >> >> downloa >> >> *jacoco-0.8.3.zip >> <http://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/0.8.3/jacoco-0.8.3.zip>* >> >> *0.8.3 <https://github.com/jacoco/jacoco/tree/v0.8.3>* >> >> 2019/01/23 >> >> 3.7 MB >> >> d4f07cb98bbf2305dbd16ee3012d7321 >> >> extract and navigate to lib directory, jacococli.jar will be there in lib >> dir. >> >> The most important thing while generating HTML report from the *.exec >> file is providing correct src and class files path so exec file can map the >> consumption of code and give you report HTML. >> for that you run like below command: >> >> java -jar <path to jacoco directory>/lib/jacococli.jar report <exec file >> path> --classfiles <TOMCAT_HOME>/webapps/dummy/WEB-INF/classes/ >> --sourcefiles /opt/dummy/web-inf/classes/ --html /tmp/report >> >> run command like above. you will get html report for sure. >> >> >> Thanks, >> >> Jiten >> >> >> >> >> On Monday, March 4, 2019 at 10:51:49 AM UTC+5:30, jk wrote: >>> >>> Hi All, >>> >>> I'm a newbie to Jacoco. I needed to perform some code coverage in our >>> webapp. The webapp is shipped as a war file running on tomcat application >>> server. Since I don't have the build information for the webapp as well the >>> source repository for it, the on-fly looked most viable option for me. >>> >>> I have defined the following in setenv.sh file: >>> >>> JACOCO_OPTS="-javaagent:/portal/bin/jacoco/lib/jacocoagent.jar=destfile=JACOCO_EXEC_FILE,output=file,append=false" >>> >>> CATALINA_OPTS="${CATALINA_OPTS} ${JACOCO_OPTS} >>> >>> when i start the webapp i do the file being created when i do browse the >>> site and shutdown catalina.sh i still the file size as 0 >>> >>> root@xxx-xxxx:/xxxxxxx/bin# ./shutdown.sh >>> Using CATALINA_BASE: /xxxxxx >>> Using CATALINA_HOME: /xxxxxx >>> Using CATALINA_TMPDIR: /xxxxxx/xxxx >>> Using JRE_HOME: /usr >>> Using CLASSPATH: >>> /xxxxxxx/bin/bootstrap.jar:/portal/bin/tomcat-juli.jar >>> -rw-r----- 1 root root 0 Mar 3 16:07 JACOCO_EXEC_FILE >>> drwxr-x--- 3 root root 4096 Mar 3 16:13 . >>> >>> >>> i'm using the following versions: >>> Server version: Apache Tomcat/8.5.29 >>> Server built: Mar 5 2018 13:11:12 UTC >>> Server number: 8.5.29.0 >>> OS Name: Linux >>> OS Version: 4.4.0-116-generic >>> Architecture: amd64 >>> JVM Version: 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12 >>> JVM Vendor: Oracle Corporation >>> >>> The Jacoco version used is : >>> jacoco/0.8.3/jacoco-0.8.3.zip >>> I would appreciate of any insight into how to resolve the issue. >>> >>> Thanks, >>> jk >>> >>> -- >> 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/DZNqIGaoPKQ/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jacoco/277a9bf5-66a7-4179-a933-a9867a797af9%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jacoco/277a9bf5-66a7-4179-a933-a9867a797af9%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/412e4e3e-08f4-42b2-8823-179a6179b905%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
