简体   繁体   中英

JaCoCo plugin between Maven and Ant

I'm trying to run my project using Ant both for unit test and code coverage over the tested code and reports of these two. Before I used Maven, but I need a report customization and find it easier with Ant. JUnit was imported automatically when I generate the build.xml from Eclipse :

<pathelement location="../../../../.m2/repository/junit/junit/4.12/junit-4.12.jar"/>

No I would like to add also the JaCoCo in my Ant build so I can run both Junit and the latter at the same time. In a lot of guides I find on the web i always find something like:

<!-- Step 1: Import JaCoCo Ant tasks -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
    <classpath path="../../../lib/jacocoant.jar" />
</taskdef>

I can easily find the jacocoant.jar file if I download the JaCoCo from the official file, but I would like to download it automatically from a dependency manager like Maven (or similar) but, after a lot of tries, I can't find the corresponding of "jacocoant.jar" through the Maven dependencies, so at the moment I can't add to JaCoCo to my Ant build.

There's a way to make this possible?

Thanks for the attention!

JaCoCo homepage contains link on documentation , which contains page "Maven Repository" :

Following JAR files are available:

 Group ID | Artifact ID | Classifier | Description -----------+----------------+------------+------------- ... org.jacoco | org.jacoco.ant | | Ant Tasks org.jacoco | org.jacoco.ant | nodeps | Ant Tasks (all dependencies included) ... 

The last one is being exactly jacocoant.jar :

wget http://repo1.maven.org/maven2/org/jacoco/jacoco/0.8.1/jacoco-0.8.1.zip
unzip jacoco-0.8.1.zip
wget http://repo1.maven.org/maven2/org/jacoco/org.jacoco.ant/0.8.1/org.jacoco.ant-0.8.1-nodeps.jar
sha256sum lib/jacocoant.jar org.jacoco.ant-0.8.1-nodeps.jar

eb375296cb836c202f35b711fee2a41bbeb447b80e54dd1fd05ef6c1d75774e3  lib/jacocoant.jar
eb375296cb836c202f35b711fee2a41bbeb447b80e54dd1fd05ef6c1d75774e3  org.jacoco.ant-0.8.1-nodeps.jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM