JaCoCo - Build

# Build

The JaCoCo build is based on Maven and can be locally executed on every machine with a proper environment setup. In particular you need at least Maven 3.5.4 and JDK 17 installations. 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 verify

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:

      ./jacoco/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 verify -DskipTests

## Compilation and testing with different JDKs

By default for compilation and execution of tests will be used JDK that runs Maven. Alternatively you can use JDK from Maven Toolchains by setting property `jdk.version`.

Following table shows in which classfile version modules will be compiled to depending on version of JDK (empty cells = no compilation possible):

Modules | JDK 5 | JDK 6 | JDK 7 | JDK 8 | JDK 9 | JDK 10 | JDK 11 | JDK 12 | JDK 13 | JDK 14 | JDK 15 | JDK 16 | JDK 17 | JDK 18 | JDK 19 | JDK 20 | JDK 21 | JDK 22
org.jacoco.core.test.validation.java21 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 21 | 21
org.jacoco.core.test.validation.java16 |  |  |  |  |  |  |  |  |  |  |  | 16 | 16 | 16 | 16 | 16 | 16 | 16
org.jacoco.core.test.validation.java14 |  |  |  |  |  |  |  |  |  | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14
org.jacoco.core.test.validation.java8 |  |  |  | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8
org.jacoco.core.test.validation.java7 |  |  | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7
org.jacoco.core.test.validation.groovy |  |  |  | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8
org.jacoco.core.test.validation.kotlin |  | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6
org.jacoco.core.test.validation.scala |  |  |  | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8
all other modules | 5 | 5 | 5 | 5 | 6 | 6 | 6 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7

Alternatively you can specify bytecode version for all modules using property `bytecode.version`.

For example to use JDK 10 from Maven Toolchains and compile all modules into bytecode version 53 (Java 9):

      mvn clean verify -Djdk.version=10 -Dbytecode.version=9

Also Eclipse Compiler for Java can be used for compilation:

      mvn clean verify -Decj

Combining these options JaCoCo is regularly tested with the following setups:

- `mvn clean verify -Djdk.version=5 -Dbytecode.version=5`
- `mvn clean verify -Djdk.version=6 -Dbytecode.version=6`
- `mvn clean verify -Djdk.version=7 -Dbytecode.version=7`
- `mvn clean verify -Djdk.version=8 -Dbytecode.version=8`
- `mvn clean verify -Djdk.version=9 -Dbytecode.version=9`
- `mvn clean verify -Djdk.version=10 -Dbytecode.version=10`
- `mvn clean verify -Djdk.version=11 -Dbytecode.version=11`
- `mvn clean verify -Djdk.version=11 -Dbytecode.version=11 -Decj`
- `mvn clean verify -Djdk.version=12 -Dbytecode.version=12`
- `mvn clean verify -Djdk.version=13 -Dbytecode.version=13`
- `mvn clean verify -Djdk.version=14 -Dbytecode.version=14`
- `mvn clean verify -Djdk.version=15 -Dbytecode.version=15`
- `mvn clean verify -Djdk.version=16 -Dbytecode.version=16`
- `mvn clean verify -Djdk.version=17 -Dbytecode.version=17`
- `mvn clean verify -Djdk.version=17 -Dbytecode.version=17 -Decj`
- `mvn clean verify -Djdk.version=18 -Dbytecode.version=18`
- `mvn clean verify -Djdk.version=19 -Dbytecode.version=19`
- `mvn clean verify -Djdk.version=20 -Dbytecode.version=20`
- `mvn clean verify -Djdk.version=21 -Dbytecode.version=21`
- `mvn clean verify -Djdk.version=21 -Dbytecode.version=21 -Decj`
- `mvn clean verify -Djdk.version=22 -Dbytecode.version=22`