Discussion:
Problems with exclusions in cobertura-maven-plugin
Ulrich Wolf
2009-04-12 14:40:53 UTC
Permalink
Hello everyone,

i'm trying to exclude several files from the cobertura overview. These files
are containing GUI-code, which doesn't need to be tested.

My directory structure:
|-tld.example.project
|--tld.example.project.database
|--tld.example.project.gui
|---...
|---tld.example.project.gui.configuration
|----tld.example.project.gui.configuration.users
|----...
|--tld.example.project.logic

I'm trying to exclude tld.example.project.gui and all subpackages from
cobertura.

Thus I tried the following pom.xml according to the documentation and a lot
of blogs and forumposts in the web:

<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<instrumentation>
<excludes>
<exclude>tld.example.project.gui.*</exclude>
</excludes>
<ignores>
<ignore>tld/example/project/gui/**/*</ignore>
</ignores>
</instrumentation>
</configuration>
<executions>
<execution>
<id>clean</id>
<phase>pre-site</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>instrument</id>
<phase>site</phase>
<goals>
<goal>instrument</goal>
<goal>cobertura</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

But this led to the same result as before I added the exclusions and
ignores. To dig to the cause, I switched on the debug-output:

[DEBUG] Setting context classloader for plugin to:
/plugins/org.codehaus.mojo:cobertura-maven-plugin:***@48/thread:main
(instance is:
ClassRealm[/plugins/org.codehaus.mojo:cobertura-maven-plugin:***@48/thread:m
ain, parent: ClassRealm[plexus.core, parent: null]])
[DEBUG] Config : <ConfigInstrumentation
basedir="C:\Stuff\eclipse\myproject\target\generated-classes\cobertura"
includes="**/*.class" />
[DEBUG] Basedir:
C:\Stuff\eclipse\myproject\target\generated-classes\cobertura
[DEBUG] Include: **/*.class
[DEBUG] Exclude:
**/*~,**/#*#,**/.#*,**/%*%,**/._*,**/CVS,**/CVS/**,**/.cvsignore,**/SCCS,**/
SCCS/**,**/vssver.scc,**/.svn,**/.svn/**,**/.arch-ids,**/.arch-ids/**,**/.DS
_Store

As you can see, nothing from the above rules gets excluded. I don't
understand why? What am I overseeing?

Thank you very much in advance!
Uli


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Benjamin Bentmann
2009-04-12 15:31:38 UTC
Permalink
Post by Ulrich Wolf
I'm trying to exclude tld.example.project.gui and all subpackages from
cobertura.
Try moving the <configuration> from the <build> section to the
<reporting> section. As mentioned in [0], a build config does not affect
a reporting plugin execution.


Benjamin


[0] http://maven.apache.org/pom.html#Reporting

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Ulrich Wolf
2009-04-12 16:03:14 UTC
Permalink
Post by Benjamin Bentmann
Try moving the <configuration> from the <build> section to the
<reporting> section. As mentioned in [0], a build config does not affect
a reporting plugin execution.
Benjamin
[0] http://maven.apache.org/pom.html#Reporting
Thanks for your reply, nice to know that! I thought that it would be the
other way round.

Now I've also tested that, but this doesn't change anything. I also tried
running cobertura separately from "site" as cobertura:cobertura, which
probably should use the <configuration> from the <build>-Section but the
output didn't change.

I also tried to exchange the notation of includes and excludes (dots &
slashes) and defining every sourcefile on its own, but all that didn't help.

Really odd behavior, I can't really see why this is happening...

Uli


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Martin777
2009-06-02 11:50:52 UTC
Permalink
Have you solved the problem? I have the same issue with Cobertura, I want to
ignore my data classes package. I've tried many combinations of
ignore/exclude, but no luck :)
Post by Ulrich Wolf
Post by Benjamin Bentmann
Try moving the <configuration> from the <build> section to the
<reporting> section. As mentioned in [0], a build config does not affect
a reporting plugin execution.
Benjamin
[0] http://maven.apache.org/pom.html#Reporting
Thanks for your reply, nice to know that! I thought that it would be the
other way round.
Now I've also tested that, but this doesn't change anything. I also tried
running cobertura separately from "site" as cobertura:cobertura, which
probably should use the <configuration> from the <build>-Section but the
output didn't change.
I also tried to exchange the notation of includes and excludes (dots &
slashes) and defining every sourcefile on its own, but all that didn't help.
Really odd behavior, I can't really see why this is happening...
Uli
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
View this message in context: http://www.nabble.com/Problems-with-exclusions-in-cobertura-maven-plugin-tp23011559p23831091.html
Sent from the mojo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Martin777
2009-06-02 12:05:32 UTC
Permalink
I've checked the plugin sources available online and it looks to me, that it
never uses the ignores or exludes, just includes everything... Could I be
right? :)
Post by Martin777
Have you solved the problem? I have the same issue with Cobertura, I want
to ignore my data classes package. I've tried many combinations of
ignore/exclude, but no luck :)
Post by Ulrich Wolf
Post by Benjamin Bentmann
Try moving the <configuration> from the <build> section to the
<reporting> section. As mentioned in [0], a build config does not affect
a reporting plugin execution.
Benjamin
[0] http://maven.apache.org/pom.html#Reporting
Thanks for your reply, nice to know that! I thought that it would be the
other way round.
Now I've also tested that, but this doesn't change anything. I also tried
running cobertura separately from "site" as cobertura:cobertura, which
probably should use the <configuration> from the <build>-Section but the
output didn't change.
I also tried to exchange the notation of includes and excludes (dots &
slashes) and defining every sourcefile on its own, but all that didn't help.
Really odd behavior, I can't really see why this is happening...
Uli
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
View this message in context: http://www.nabble.com/Problems-with-exclusions-in-cobertura-maven-plugin-tp23011559p23831281.html
Sent from the mojo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Martin777
2009-06-02 12:18:56 UTC
Permalink
Sorry, I was wrong, the configuration is loaded correctly, I see the
includes, ignores and excludes, but it seems like the ignores have no
effect. Now I am confused.
Post by Martin777
I've checked the plugin sources available online and it looks to me, that
it never uses the ignores or exludes, just includes everything... Could I
be right? :)
Post by Martin777
Have you solved the problem? I have the same issue with Cobertura, I want
to ignore my data classes package. I've tried many combinations of
ignore/exclude, but no luck :)
Post by Ulrich Wolf
Post by Benjamin Bentmann
Try moving the <configuration> from the <build> section to the
<reporting> section. As mentioned in [0], a build config does not affect
a reporting plugin execution.
Benjamin
[0] http://maven.apache.org/pom.html#Reporting
Thanks for your reply, nice to know that! I thought that it would be the
other way round.
Now I've also tested that, but this doesn't change anything. I also tried
running cobertura separately from "site" as cobertura:cobertura, which
probably should use the <configuration> from the <build>-Section but the
output didn't change.
I also tried to exchange the notation of includes and excludes (dots &
slashes) and defining every sourcefile on its own, but all that didn't help.
Really odd behavior, I can't really see why this is happening...
Uli
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
View this message in context: http://www.nabble.com/Problems-with-exclusions-in-cobertura-maven-plugin-tp23011559p23831490.html
Sent from the mojo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Ulrich Wolf
2009-06-02 12:20:44 UTC
Permalink
You are right, this problem was never solved...

Still looking for a solution, but haven't found one yet.

Uli

-----Ursprüngliche Nachricht-----
Von: Martin777 [mailto:***@ami.cz]
Gesendet: Dienstag, 2. Juni 2009 14:06
An: ***@mojo.codehaus.org
Betreff: Re: AW: [mojo-user] Problems with exclusions in
cobertura-maven-plugin


I've checked the plugin sources available online and it looks to me, that it
never uses the ignores or exludes, just includes everything... Could I be
right? :)
Post by Martin777
Have you solved the problem? I have the same issue with Cobertura, I want
to ignore my data classes package. I've tried many combinations of
ignore/exclude, but no luck :)
Post by Ulrich Wolf
Post by Benjamin Bentmann
Try moving the <configuration> from the <build> section to the
<reporting> section. As mentioned in [0], a build config does not affect
a reporting plugin execution.
Benjamin
[0] http://maven.apache.org/pom.html#Reporting
Thanks for your reply, nice to know that! I thought that it would be the
other way round.
Now I've also tested that, but this doesn't change anything. I also tried
running cobertura separately from "site" as cobertura:cobertura, which
probably should use the <configuration> from the <build>-Section but the
output didn't change.
I also tried to exchange the notation of includes and excludes (dots &
slashes) and defining every sourcefile on its own, but all that didn't help.
Really odd behavior, I can't really see why this is happening...
Uli
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
View this message in context:
http://www.nabble.com/Problems-with-exclusions-in-cobertura-maven-plugin-tp2
3011559p23831281.html
Sent from the mojo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Grzegorz Slowikowski
2009-06-02 17:41:36 UTC
Permalink
I followed the instructions here:
http://mojo.codehaus.org/cobertura-maven-plugin/usage.html
and it works.

My configuration:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<instrumentation>
<ignores>
<ignore>my.package.to.ignore.*</ignore>
</ignores>
<excludes>
<exclude>my/package/to/ignore/*.class</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
</plugins>
</reporting>

The "ignores" must contain dots, and the "excludes" - slashes.

Greetings to all.

Grzegorz Slowikowski
Post by Ulrich Wolf
You are right, this problem was never solved...
Still looking for a solution, but haven't found one yet.
Uli
-----Ursprüngliche Nachricht-----
Gesendet: Dienstag, 2. Juni 2009 14:06
Betreff: Re: AW: [mojo-user] Problems with exclusions in
cobertura-maven-plugin
I've checked the plugin sources available online and it looks to me, that it
never uses the ignores or exludes, just includes everything... Could I be
right? :)
Post by Martin777
Have you solved the problem? I have the same issue with Cobertura, I want
to ignore my data classes package. I've tried many combinations of
ignore/exclude, but no luck :)
Post by Ulrich Wolf
Post by Benjamin Bentmann
Try moving the <configuration> from the <build> section to the
<reporting> section. As mentioned in [0], a build config does not affect
a reporting plugin execution.
Benjamin
[0] http://maven.apache.org/pom.html#Reporting
Thanks for your reply, nice to know that! I thought that it would be the
other way round.
Now I've also tested that, but this doesn't change anything. I also
tried
Post by Martin777
Post by Ulrich Wolf
running cobertura separately from "site" as cobertura:cobertura, which
probably should use the <configuration> from the <build>-Section but the
output didn't change.
I also tried to exchange the notation of includes and excludes (dots &
slashes) and defining every sourcefile on its own, but all that didn't help.
Really odd behavior, I can't really see why this is happening...
Uli
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
http://www.nabble.com/Problems-with-exclusions-in-cobertura-maven-plugin-tp2
3011559p23831281.html
Sent from the mojo - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Loading...