Skip to content
This repository was archived by the owner on Oct 25, 2022. It is now read-only.
This repository was archived by the owner on Oct 25, 2022. It is now read-only.

jacoco plugin: Ability to opt-out projects #2

Description

@ben-manes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions