Build
The JaCoCo build is fully based on Maven
and its extension Tycho to build
OSGi bundles based on the declations in their MANIFEST.MF
file
("manfest-first" approach). The build can be locally executed on every machine
with a proper environment setup. In particular
you need a Maven 3 installation.
Developers are encouraged to run the build before every commit to ensure
consistency of the source tree.
Running the Build
The build can be started by executing the following command with
./org.jacoco.build/
as the working directory:
mvn clean install
Total build time is typically around 3 minutes, however first build might take more time, because Maven should download plugins and dependencies. The download ZIP will be created at the following location:
./org.jacoco.doc/target/jacoco-x.y.z.qualifier.zip
Running Quick Build without Tests
It is not recommended, however possible to the run build without any tests:
mvn clean install -DskipTests
Testing with different JDKs
Target Java version for JaCoCo builds is 1.5, however for verification
purposes you can execute tests using other versions. In order to do so, first
you should create file toolchains.xml
in ~/.m2/
directory. Here is an example of such file. For more information see
Maven
Guide to Using Toolchains.
<?xml version="1.0" encoding="UTF8"?> <toolchains> <toolchain> <type>jdk</type> <provides> <id>java15</id> <version>1.5</version> <vendor>sun</vendor> </provides> <configuration> <jdkHome>/usr/lib/jvm/sun-jdk-1.5</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <id>java16</id> <version>1.6</version> <vendor>sun</vendor> </provides> <configuration> <jdkHome>/usr/lib/jvm/sun-jdk-1.6</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <id>java17</id> <version>1.7</version> <vendor>sun</vendor> </provides> <configuration> <jdkHome>/usr/lib/jvm/sun-jdk-1.7</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <id>java18</id> <version>1.8</version> <vendor>sun</vendor> </provides> <configuration> <jdkHome>/usr/lib/jvm/sun-jdk-1.8</jdkHome> </configuration> </toolchain> </toolchains>
Now you should be able to execute maven build with specified version of JDK:
mvn clean install -Djdk.version=version
Location of toolchains.xml
can be set via an option:
mvn --toolchains path clean install -Djdk.version=version
In addition JaCoCo can be compiled for higher class file versions than 1.5
specifying the property bytecode.version
. Note that in this case
the version of the JVM running Maven must be at least the version of the
specified bytecode version as this JVM is also running the tests. Combining
these options JaCoCo is regularly tested with the following setups:
- Maven with 1.5 JDK:
mvn clean install -Djdk.version=1.5 -Dbytecode.version=1.5
- Maven with 1.6 JDK:
mvn clean install -Djdk.version=1.6 -Dbytecode.version=1.6
- Maven with 1.7 JDK:
mvn clean install -Djdk.version=1.7 -Dbytecode.version=1.7
- Maven with 1.8 JDK:
mvn clean install -Djdk.version=1.8 -Dbytecode.version=1.8