Hi David,

I think the reason is because the <contextFilter> configuration element is a property of the report mojo and thus it needs to be defined in the <reporting> section and not in the <build> section. For example:

<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clover-plugin</artifactId>
        <configuration>
          <!-- Verify that context filters work -->
          <contextFilters>try</contextFilters>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

Let me know if this works for you and I'll update the documentation.

Thanks
-Vincent

On Jan 18, 2007, at 11:07 PM, c_inconnu2 wrote:

Hi Vincent,

Thanks for your answer. Indeed there is no reason that it should work : I was just wondering... But I tried to use contextFilters and I cannot manage to get it work either. Here is a part of my pom :

   <reporting>
       <plugins>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-clover-plugin</artifactId>
           </plugin>

           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>surefire-report-maven-plugin</artifactId>
           </plugin>
       </plugins>
   </reporting>

   <build>
       <plugins>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
               <configuration>
                   <source>1.5</source>
                   <target>1.5</target>
                   <showDeprecation>true</showDeprecation>
               </configuration>
           </plugin>

           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-clover-plugin</artifactId>
               <configuration>
                   <jdk>1.5</jdk>
                   <contextFilters>try</contextFilters>
               </configuration>
               <executions>
                   <execution>
                       <phase>pre-site</phase>
                       <goals>
                           <goal>instrument</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>
       </plugins>
   </build>

I tested with this :

public static String f()
   {
       try
       {
           if(true){
               Class.forName("AAA");                        }
           Class.forName("BBB");
       }
       catch (Exception e)
       {
           // TODO: handle exception
       }
       return "f";
   }

If I understand, the line Class.forName("BBB"); should be reported as not tested ??? But it is in red in the report ("statement not executed"). And Class.forName("AAA"); was executed

Thanks for your help

Vincent Massol a écrit :
Hi David,

Why are you assuming that <statementContext> would work?

Just check the plugin documentation and you'll see that the correct tag name is <contextFilters>. Just check the documentation for more details and examples.

Thanks
-Vincent

On Jan 17, 2007, at 11:46 PM, c_inconnu2 wrote:

Hi,

I am trying to configure Clover to use "contextFilters" with "statementContext". Here is my pom.xml :

<reporting>
       <plugins>
           ...
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-clover-plugin</artifactId>
               <configuration>
                   <jdk>1.5</jdk>
                   <excludes>
                       <exclude>**/*AllTests.java</exclude>
                       <exclude>**/*Main.java</exclude>
                       <exclude>**/*Main$*.java</exclude>
                       <exclude>**/*Test.java</exclude>
                       <exclude>**/*Test$*.java</exclude>
                   </excludes>
<statementContext name="log" regexp="^logger \..*" /> <!--statementContext name="iflog" regexp="^if \ (logger\.is.*" /--> <statementContext name="iflog" regexp="if.?.? log.*\.isDebugEnabled.*}" />
                   <!--contextFilters>log,iflog</contextFilters-->
                   <contextFilters>try</contextFilters>
               </configuration>
           </plugin>
           ...
       <plugins>
<reporting>

as you can see, I tried many things. I looked the clover site, search mailing lists but nothing... I even looked into the plugin source code : it seems that it does not handle "statementContext".
But since even the "try" context does not work...

Any help will be greatly appreciated, thanks

David





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son 
interface révolutionnaire.
http://fr.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to