gradle-plugins icon indicating copy to clipboard operation
gradle-plugins copied to clipboard

jacoco plugin: Ability to opt-out projects

Open ben-manes opened this issue 13 years ago • 1 comments

Our repository includes a Tests project that contains only integration tests and no main classes. This is due to the repository originally not using the Maven standard layout. These tests are gradually being rewritten into proper unit tests, etc. as the code base is modularized. However, the Jacoco task does not work properly in this scenario without a placeholder file in main.

FAILURE: Build failed with an exception.

* Where:
Script 'https://raw.github.com/brunodecarvalho/gradle-plugins/master/jacoco-multiproject-aggregator.gradle' line: 99

* What went wrong:
Execution failed for task ':coverageReport'.
> /home/ben/projects/AMP/Tests/build/classes/main does not exist.

Another use-case is nested subprojects. For example infra:libraries:server is a library that contains the common infrastructure for a server. The infra and libraries projects are empty as they exist just for organization. Unfortunately the JaCoCo plugin fails here too.

FAILURE: Build failed with an exception.

* Where:
Script 'https://raw.github.com/brunodecarvalho/gradle-plugins/master/jacoco-multiproject-aggregator.gradle' line: 99

* What went wrong:
Execution failed for task ':coverageReport'.
> /home/ben/projects/AMP/infra/build/classes/main does not exist.

* Try:
Run with --info or --debug option to get more log output.

We have a multi-language build (Java and Scala). I don't think that JoCoCo would provide appropriate test coverage. Instead I'd probably use SCCT.

My preferred solution to this would be to allow the user to specify the sub-projects to opt-in. If I only apply this plugin to the rootProject and Java projects, it fails with the error:

FAILURE: Build failed with an exception.

* Where:
Script 'https://raw.github.com/brunodecarvalho/gradle-plugins/master/jacoco-multiproject-aggregator.gradle' line: 132

* What went wrong:
Could not find property 'test' on project ':infra'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

ben-manes avatar Nov 15 '12 00:11 ben-manes

Sounds like a tricky build setup. Why not open up a pull request to submit your proposals? :)

biasedbit avatar Nov 25 '12 01:11 biasedbit