Open mfarid opened 8 years ago
Version 2.3.0 hasn't been released yet. I probably should have waited until it was to update the README.md file :-)
I hope to have a release out in the next few days. Until then, you can use version 2.2.8. If you need the Android support in version 2.3.0, I just updated the snapshot to Maven's Snapshot repository. You can use the snapshot release by including https://oss.sonatype.org/content/repositories/snapshots/ in your build's repository list.
Sorry for the confusion.
Thanks a lot for your quick response, I appreciate it.
I was able to move forward with the suggested changes.However, i am getting another issue related to cobertura dependency. This seems to be related to plugin's build file.
What went wrong: Execution failed for task ':instrument'.
Could not resolve all dependencies for configuration ':cobertura'. Cannot resolve external dependency net.sourceforge.cobertura:cobertura:2.1.1 because no repositories are defined. Required by: ai.h2o:h2o-3:3.7.0
Looks like it has something to do with the plugin's build.gradle file. Please suggest how to move forward here.
Version 2.3.0 of the plugin has now been released. Do you still have a problem with the dependencies during instrumentation?
Hi @stevesaliman , I seem to be hitting the same problem with 2.3.1 on a project with multiple subprojects:
$ ./gradlew cobertura --continue
Execution failed for task ':instrument'.
Could not resolve all dependencies for configuration ':cobertura'. Cannot resolve external dependency net.sourceforge.cobertura:cobertura:2.1.1 because no repositories are defined. Required by: :src:unspecified
My build.gradle contains:
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2" }
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.1'
classpath 'net.saliman:gradle-cobertura-plugin:2.3.1'
}
}
apply plugin: 'cobertura'
cobertura {
rootProject.subprojects.each {
coverageDirs << file("${it.name}/build/classes/main")
}
coverageFormats = ['html', 'xml']
coverageIgnoreTrivial = true
coverageReportDir =new File("${buildDir}/reports/cobertura")
}
Interestingly, cobertura does work for each subproject, which I configure like this:
configure(subprojects.findAll()) {
apply plugin: 'java'
apply plugin: 'cobertura'
...
repositories {
mavenCentral()
mavenLocal()
}
I can generate reports in the build dir of each subproject both using "./gradlew cobertura" and "./gradlew $submodule:cobertura". But the former will fails on the root project, with the error quoted above.
I've tried with 2.2.8 and 2.3.0 and with the sonatype repo linked above, but same error.
Thanks!
I'm not sure what might be happening in your case. I tried a test by using the code in this project's testclient
directory. I did 2 things:
buildSrc
directory in testclient
so that the plugin source wouldn't be available.testclient/build.gradle
:buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.3.1'
}
}
Then, from the testclient
directory, I ran gradle cobertura
. The task was available on the root project, and it ran the coverage reports in the child projects. One difference is that my parent project doesn't have any code of its own. I'll try to look into that over the weekend.
Thanks @stevesaliman , let me know if I can give more info.
FYI, I recently ran into a similar error with a multi-project build. Turns out my subproject settings.gradle files were incorrect (rootProject.name). YMMV.
I am facing same problem with multi module build. My root project does not have any code!! I am using version 2.3.1
What went wrong: Execution failed for task ':instrument'.
Could not resolve all dependencies for configuration ':cobertura'. Cannot resolve external dependency net.sourceforge.cobertura:cobertura:2.1.1 because no repositories are defined. Required by:
I still have the same issue, I did get the root project to aggregate all test results normally for example, so it looks like it's something specific to the cobertura plugin. Let me know if I can give a hand (or any pointers to debug it myself)
I think i found a workaround. You need also to define repository in root of build file (not in buildscript block).
So I got cobertura plugin working by applying the plugin to only the subprojects and not allprojects. This means I was not able to merge my reports using coverageMergeDatafiles because cobertura is not available at rootproject level. Any ideas?
@shubh-jain Just add repository to the root file, as example:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.3.1'
}
}
repositories { //<====== Add this one
mavenCentral()
}
This should work.
@Propheta13 Thanks
Getting error while using the plugin.
I tried to use this plugin using the suggested approach from the usage page, with https://github.com/h2oai/h2o-3 project.
I am getting the following error:
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'h2o-3'.
I tried to find any forum or mailing list but could not find anything in any of the .md files. Please pardon me if I missed to check somewhere.