# Could not get property 'test' on subproject

**URL:** <https://discuss.gradle.org/t/could-not-get-property-test-on-subproject/44607>\
**Category:** Help/Discuss\
**Created:** [January 5, 2023, 8:59am UTC](https://discuss.gradle.org/t/could-not-get-property-test-on-subproject/44607 "2023-01-05T08:59:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![theresac23](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@theresac23](https://discuss.gradle.org/u/theresac23)\
**Post date:** [January 5, 2023, 8:59am UTC](https://discuss.gradle.org/t/could-not-get-property-test-on-subproject/44607/1 "2023-01-05T08:59:10Z")

</div>

I have a multi-module project and using jacoco get a code coverage report across all subprojects.

Theres the task

```gradle
task codeCoverageReport(type: JacocoReport) {
    dependsOn = subprojects.test
    // Gather execution data from all subprojects
    executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")

    additionalSourceDirs.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
    sourceDirectories.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
    classDirectories.setFrom files(subprojects.sourceSets.main.output).collect {
        fileTree(dir: it, exclude: coverageExcludedClassDirectories)
    }
...
}

```

but when calling .gradlew build I get the error `Could not get unknown property 'test' for project ':project-name' of type org.gradle.api.Project.` even though there are tests defined. Without the dependency on the test the build still errors saying it cannot find the property ‘sourceSets’.

What can I do for the build to find the subproject properties?

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [January 12, 2023, 8:39pm UTC](https://discuss.gradle.org/t/could-not-get-property-test-on-subproject/44607/2 "2023-01-12T20:39:53Z")

</div>

Just don’t even try to do what you try to do.  
This is highly unsupported and unsafe.  
You need to use proper way to share outputs between projects as documented at [Sharing outputs between projects](https://docs.gradle.org/current/userguide/cross_project_publications.html).

But you could also simply use [The JaCoCo Report Aggregation Plugin](https://docs.gradle.org/current/userguide/jacoco_report_aggregation_plugin.html) which does exactly what you intend, just the safe way documented at the link above. 😉
