Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.5.2
    • Labels:
      None
    • Environment:
      Windows
    • Number of attachments :
      3

      Description

      After adding this to the POM:

      <build>
      <plugins>
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <configuration>
      <instrumentation>
      <excludes>
      <exclude>org/example/**/*Test.class</exclude>
      <exclude>$

      {basedir}

      </exclude>
      </excludes>
      </instrumentation>
      <check>
      <haltOnFailure>false</haltOnFailure>
      </check>
      </configuration>
      <executions>
      <execution>
      <goals>
      <goal>clean</goal>
      </goals>
      </execution>
      </executions>
      </plugin>
      </plugins>
      </build>

      Cobertura still reports on all classes.

      1. Issue52Patch2.patch
        7 kB
        Miguel Almeida
      2. Issue52Patch3.patch
        8 kB
        Miguel Almeida
      3. Issue52Patch4.patch
        8 kB
        Miguel Almeida

        Issue Links

          Activity

          Hide
          Robert Scholte added a comment -

          The exclude is not a problem (anymore), the ignore is. Let's first figure out why there are two options which kind of do the same thing based on the name.

          Show
          Robert Scholte added a comment - The exclude is not a problem (anymore), the ignore is. Let's first figure out why there are two options which kind of do the same thing based on the name.
          Hide
          Miguel Almeida added a comment -

          According to http://maven.40175.n5.nabble.com/Cobertura-what-is-ignore-used-for-in-maven-I-don-t-see-it-mentioned-td114935.html :

          "I'm guessing that ignore will still measure the coverage, but if you are enforcing a minimum coverage number, that package will be ignored. Exclude will not even bother measuring the coverage "

          Show
          Miguel Almeida added a comment - According to http://maven.40175.n5.nabble.com/Cobertura-what-is-ignore-used-for-in-maven-I-don-t-see-it-mentioned-td114935.html : "I'm guessing that ignore will still measure the coverage, but if you are enforcing a minimum coverage number, that package will be ignored. Exclude will not even bother measuring the coverage "
          Hide
          Robert Scholte added a comment -

          I figured out the difference: include/exclude has to do with the files to instrument.
          According to the docs of Cobertura

          Parameter Required? Description Default Value
          --ignore No Specify a regular expression to filter out certain lines of your source code. This is useful for ignoring logging statements, for example. You can have as many <ignore/> statements as you want. No files are ignored.

          It's a shame there's no example. I'll have to search for that, add a FAQ entry for it and document it better in the code.

          Show
          Robert Scholte added a comment - I figured out the difference: include/exclude has to do with the files to instrument. According to the docs of Cobertura Parameter Required? Description Default Value --ignore No Specify a regular expression to filter out certain lines of your source code. This is useful for ignoring logging statements, for example. You can have as many <ignore/> statements as you want. No files are ignored. It's a shame there's no example. I'll have to search for that, add a FAQ entry for it and document it better in the code.
          Hide
          Robert Scholte added a comment -

          Fixed in rev. 15530
          The excludes was already fixed somewhere in the past. I've added a FAQ entry about the meaning of ignores.

          Show
          Robert Scholte added a comment - Fixed in rev. 15530 The excludes was already fixed somewhere in the past. I've added a FAQ entry about the meaning of ignores .
          Hide
          Dmitry Goldenberg added a comment -

          Folks,

          I can see that this is fixed in 2.6 according to this issue. When is this version going to be officially available? http://repo1.maven.org/maven2/ only has versions up to 2.5.1 but not 2.6.

          Also it seems that includes don't work E.g. shouldn't the following work effectively as an exclude? I.e. if I have com.foo.pkg1 and com.foo.pkg2, shouldn't the below only instrument pkg1 and leave pkg2 not included?

          <build>
          <plugins>
          <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>cobertura-maven-plugin</artifactId>
          <configuration>
          <instrumentation>
          <includes>
          <include>com/foo/pkg1/*.class</include>
          </includes>
          </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>

          Show
          Dmitry Goldenberg added a comment - Folks, I can see that this is fixed in 2.6 according to this issue. When is this version going to be officially available? http://repo1.maven.org/maven2/ only has versions up to 2.5.1 but not 2.6. Also it seems that includes don't work E.g. shouldn't the following work effectively as an exclude? I.e. if I have com.foo.pkg1 and com.foo.pkg2, shouldn't the below only instrument pkg1 and leave pkg2 not included? <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <configuration> <instrumentation> <includes> <include>com/foo/pkg1/*.class</include> </includes> </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>

            People

            • Assignee:
              Robert Scholte
              Reporter:
              Jim Wilson
            • Votes:
              16 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: