Using Clover with projects that require class post-processing
-------------------------------------------------------------

         Key: MCLOVER-16
         URL: http://jira.codehaus.org/browse/MCLOVER-16
     Project: Maven 2.x Clover Plugin
        Type: Bug

    Versions: 2.0    
    Reporter: mike perham
     Fix For: 2.0


I don't know if this is a bug in the clover plugin but I have a project which 
compiles some classes and then uses backport175 to process annotations on those 
source files and add them to the generated classes since we are still using JDK 
1.4.  I'm finding that my tests run fine by themselves but fail when I run 
Clover, exactly as if the annotations were not in the classes.

I think what is happening is that maven is running code in this order:

compile source -> target/clover/classes
instrument classes -> target/clover/classes
process classes for annotations -> target/classes

My backport configuration looks like this:

    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
                        <id>normal</id>
            <phase>process-classes</phase>
            <configuration>
              <tasks>

                                <taskdef name="annotationc" 
                                         
classname="org.codehaus.backport175.compiler.task.AnnotationCTask" 
                                         
classpathref="maven.compile.classpath"/>

                                 <annotationc 
destdir="${project.build.outputDirectory}" 
                                        
properties="${project.build.sourceDirectory}/annotations.properties" 
                                        verbose="false">
                                        <src 
path="${project.build.sourceDirectory}" />
                                        <classpath 
path="${project.build.outputDirectory}"/>
                                        <classpath 
refid="maven.compile.classpath" />
                                </annotationc>
                
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
                        <id>test</id>
            <phase>test-compile</phase>
            <configuration>
              <tasks>

                                <taskdef name="annotationc" 
                                         
classname="org.codehaus.backport175.compiler.task.AnnotationCTask" 
                                         classpathref="maven.test.classpath"/>

                                 <annotationc 
destdir="${project.build.testOutputDirectory}" 
                                        
properties="${project.build.sourceDirectory}/annotations.properties" 
                                        verbose="false">
                                        <src 
path="${project.build.testSourceDirectory}" />
                                        <classpath 
path="${project.build.testOutputDirectory}"/>
                                        <classpath refid="maven.test.classpath" 
/>
                                </annotationc>
                
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>


As you can see, I'm using all the standard Maven variables for directory names. 
 Is there some way to get the Clover plugin working in this scenario?  Should 
the project.build.outputDirectory variable be modified to point to 
target/clover/classes?  Perhaps a bit of documentation on how to use the Clover 
plugin with projects that require class processing would be called for here.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to