I\'m trying to configure JaCoCo maven plugin from command line insted of using pom.xml
. I have managed to execute prepare-agent
so far with command
When You can not use property, you can use environment variable.
When I get Jacoco Diff Coverage jacoco:report includes cannot use property.
So I use ${inc_files}
Shell:
echo "+++git diff+++"
inc_files=`git diff --name-only master | grep -oP 'com/languoguang/xxclouds/quark.*.java' | xargs | sed 's/.java/.class/g' | xargs | sed -e 's/ /,/g'`;
echo ${inc_files};
echo "---git diff---";
echo "+++maven test jacoco+++";
mvn -B -f pom.xml -Dinc_files=${inc_files} clean test -Dmaven.test.failure.ignore=true;
echo "---maven test jacoco---";
pom.xml:
quark-frameworks-coverage-inc
${project.reporting.outputDirectory}/jacoco-aggregate/jacoco-aggregate-inc/
${inc_files}
report-aggregate-inc
test
report-aggregate
I hope this will be useful.