This is most likely just a beginner Gradle users question but I can't seem to figure this out.
I am trying to just get the basic task of jacocoTestReport running for a multi-project build for a Gradle project I've been handed.
In the root project build.gradle file we have:
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.5'
}
Under dependencies we have:
jacocoAgent files("${rootProject.rootDir}/path/to/jacoco/zip/file/jacoco-0.8.5.201910111838.zip")
This zip file jacoco-0.8.5.201910111838.zip contains:
- coverage
- doc
- lib
- jacocoagent.jar
- jacocoant.jar
- jacococli.jar
- org.jacoco.agent-0.8.5.201910111838.jar
- org.jacoco.ant-0.8.5.201910111838.jar
- org.jacoco.core-0.8.5.201910111838.jar
- org.jacoco.report-0.8.5.201910111838.jar
- test
- index.html
I haven't included the files in the other folders than lib for brevity.
In a dependencies.build.gradle file we have a reference to:
jacoco_agent : "org.jacoco:org.jacoco.agent:0.8.5"
jacoco_ant : "org.jacoco:org.jacoco.ant:0.8.5"
When running ./gradlew.bat tasks I can see the under verification tasks jacocoTestReport
When I try to run ./gradlew.bat jacocoTestReport I get the following error:
- What went wrong: Execution failed for task ':myProject:jacocoTestReport'.
Could not resolve all files for configuration ':myProject:jacocoAnt'. Could not find org.jacoco:org.jacoco.ant:0.8.5. Searched in the following locations: - file:/C:/the/folder/with/zipFile/org.jacoco.ant-0.8.5.jar - file:/C:/the/folder/with/zipFile/org.jacoco.ant-0.8.5.jar - file:/C:/a/folder/without/zipFile/org.jacoco.ant-0.8.5.jar - file:/C:/a/folder/without/zipFile/org.jacoco.ant-0.8.5.jar - file:/C:/the/folder/with/zipFile/org.jacoco.ant-0.8.5.jar - file:/C:/another/folder/withOut/zipFile/org.jacoco.ant-0.8.5.jar - file:/C:/another/folder/without/zipFile/org.jacoco.ant.jar Required by: project :myProject
This is quite a large Gradle file so as a Gradle beginner it's a lot to go through, I've found various references to this repositories setup:
repositories {
ivy {
artifactPattern 'file://' + rootProject.file('some/folder') + '/[organisation]/[module]-[revision](.[ext])'
...
}
}
Which matches the zip file location.
If Gradle can find the zip file and use the jacocoAgent (which is inside the zip file as a jar) how come it can't use the ant jar from within the same zip file?
This is using Gradle wrapper with Gradle version 6.5 for a multi Java project application.