1、启动脚本添加:
JAVA_OPTS="-javaagent:/opt/app/jacoco/jacocoagent.jar=destfile=/opt/app/jacoco/bjca-jacoo.exec,append=true,includes=cn.org.bjca.*,output=tcpserver,port=9999,address=* ${JAVA_OPTS}"
2、启动tomcat服务
3、收集结果
java -jar ./jacococli.jar dump --address 192.168.126.240 --port 9999 --reset --destfile ./example.exec
4、合并结果
java -jar ./jacococli.jar merge 1.exec 2.exec --destfile ./example.exec
5、 配置编译后文件及源码,生成报告
java -jar ./jacococli.jar report ./example.exec --classfiles clazz --sourcefiles src --html report/ca --xml report/ca.xml --encoding utf-8
标签:java,tomcat,exec,--,jar,Agent,destfile,jacoco From: https://www.cnblogs.com/wutongxiaoyuyear/p/17172335.html