About Eric Wendelin
eriwen / gradle-cobertura-plugin Goto Github PK
View Code? Open in Web Editor NEWGradle plugin for Cobertura
License: Apache License 2.0
Gradle plugin for Cobertura
License: Apache License 2.0
Hi guys,
Thanks for this plugin, it's really clean and readable.
But, I have an issue here, I don't know the reason, the thing is like this:
I followed the quickstart guideline and the cobertura configuration is like:
cobertura {
format = 'html'
includes = ['/*.java']
excludes = ['/domain//.java']
ignores = ['com.domain.']
}
After doing this, seems excludes and ignores are all not working, the report still includes the source files under package domain.
Is there something wrong with configuration?
Looking forward to your answer.
Cheers.
David
How about a 'both' option? We need HTML for human-readable and XML to interface with our build server.
Thanks for the work by the way - I've tried another cobertura plugin and yours is way nicer!
Thanks,
Jeff
Hello,
Is there any chance you could incorporate the cobertura-check target so the build fails if coverage falls below a certain level? I'm using Groovy so Cobertura is my only option.
Thanks!
Cobertura coverage report is really helpful especially when I build project through Jenkins. Then I can see the coverage reports. However, I do not want the build to execute cobertura when I am building my project locally. Currently, cobertura kicks in automatically when used along with java plugin. Is there a way to disable it so that it does not run?
Executing the task testCoberturaReport
seems to cause an issue if the project doesn't contain any tests. This behavior only occurs with Gradle 1.7 but could not be observed with 1.6.
A problem was found with the configuration of task ':myProject:testCoberturaReport'.
> File '/Users/benjamin/dev/myProject/build/cobertura/main/cobertura-test.ser' specified for property 'serFile' does not exist.
Build message :
The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
I'm setting the ignores property properly and I see it getting set in the gradle-cobertura-plugin code but cobertura-check task still reports that the classes I've included don't have enough coverage. Does anybody have any insight to the relationship to the ignores property and cobertura-check? The cobertura-instrument task documentation confuses me: "You can tell Cobertura to ignore certain classes by passing in "ignore" regular expressions. The ignore pattern can be any valid perl 5 regular expression. This will ignore any calls to any method that matches the ignore regular expression. It will NOT skip over these classes during instrumention. . To exclude classes from being instrumented, either exclude them from your fileset or use the alternative method below and specify an excludeClasses pattern." I've only been able to get past cobertura-check by excluding the classes from instrumentation (I hacked a copy of the code because there does not appear to be a way to exclude classes from instrumentation in the plugin).
Adding the mapvine gradle-cobertura dependency to my buildscript { } block changed the way Gradle looked up my dependencies - ie. instead of using my virtual repo (local, then caches, then mavenCentral) it straightaway looked up jms-1.1.jar in repo1 and failed to resolve (since repo1 doesn't have the jms jar). I have the jar in my Artifactory repo in gradle-plugins-release-cache that is in my virtual repo's list. Note: If I remove the mapvine dependency, my builds work fine. Any ideas where to look?
I was trying to add another test source set to be included in code coverage. After having a brief look at the plugin code, it looked as if you can added through the extension method addCoverage
:
task integrationTest(type: Test) {
...
}
cobertura {
addCoverage(integrationTest, sourceSets.main)
}
However, when executing the task, I run into an error:
:integrationTestCoberturaReport FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':integrationTestCoberturaReport'.
> File '/Users/ben/testproject/build/cobertura/main/cobertura-test.ser' specified for property 'serFile' does not exist.
Is there a way of doing this? Maybe it's just not documented. Sorry, I didn't have a deep look at the task code yet.
In my build script: project.buildDir = 'target' is ignored and cobertura reports go to .\build\reports\cobertura\index.html.
Is the cobertura reports directory configurable? Could it use the overridden buildDir set in my rootProject's build.gradle?
Do this (at the bottom) - Ant Task reference
Hello,
I've been trying to use this plugin without a maven repository connection. I'm able to load the cobertura library using the following:
...
repositories {
flatDir(dir: "$rootDir/lib/test", name:'test libs directory')
}
...
dependencies {
testCompile ":cobertura:1.9.4.1@jar"
}
...
However it fails on :coberturaInstrumentMain. It seems that the cobertura library can't find it's dependencies...
12:54:57.486 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:cobertura-instrument] java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
I've tried several different ways to add the dependencies to the classpath (asm-3.0.jar, asm-tree-3.0.jar, log4j-1.2.9.jar, ant-1.7.0.jar, and oro-2.0.8.jar) but I'm not having any luck.
After looking at the plugin source, I think it's trying to load them transitively based on information from an ivy file, but I'm not sure as I've never used ivy before.
Is it possible to add dependencies to the plugin classpath based on some configuration attribute? Unfortunately I'm developing in a disconnected environment and need to configuration control all dependencies.
Thanks,
John
We want both the HTML report (for immediate dev) and XML report (for jenkins). Please can this plugin offer xml.enabled and html.enabled, rather than format=xml/html.
We can work around this by invoking the ant task for now, but that's ugly.
I'm searching for a gradle cobertura plugin that supports my scenario: I have a multiproject where several projects contains some logically related contents and a single project that provides tests for all other projects.
The tests have been moved to a dedicate project cause I every project is backed by an eclipse project, and eclipse doesn't support separating tests from sources (within a single project).
See http://tech.groups.yahoo.com/group/junit/message/22398
So launching gradle clean testCoberturaReport on a gradle multiproject structure like the following
. //the multi-project
|-- build.gradle
|-- prj1 //the 'real' project
| |-- build.gradle
| `-- src
| `-- main
| `-- groovy
| `-- Foo.groovy
|-- settings.gradle
`-- testprj //the test project
|-- build.gradle
`-- src
`-- test
`-- groovy
`-- FooTest.groovy //tests for Foo.groovy
I have the following problem:
I've uploaded an archive with the complete multiproject test case.
UPDATE: I've filed a similar issue to other gradle-cobertura plugins... is there any change to join your forces and provide a unified, comprehensive plugin that supports even my scenario?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.