views:

415

answers:

1

Hi,

I have a following Problem. I would like to exclude some .java files (*/jsfunit/.java) during test-compile phace and on the other side i would like to include them during compile phace (id i start tomact with tomcat:run goal)

My pom.xml

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                 <!-- <excludes>
                     <exclude>**/*JSFIntegration*.java</exclude>
                 </excludes> -->                    
            </configuration>
           <executions>
           <!-- <execution>
                        <id>default-compile</id>
                        <phase>compile</phase>
                        <goals>
                          <goal>compile</goal>
                        </goals>
                        <configuration>
                            <includes>
                                 <include>**/jsfunit/*.java</include>
                            </includes>
                        </configuration>
               </execution>-->
              <execution>
                        <id>default-testCompile</id>
                        <phase>test-compile</phase>
                        <configuration>
                            <excludes>
                                <exclude>**/jsfunit/*.java</exclude>
                            </excludes>
                        </configuration> 
                        <goals>

                <goal>testCompile</goal>
                        </goals>
                </execution>                  
             </executions>

        </plugin>

But it does not work : exclude in default-testCompile execution does not filter these classes. If i remove the comments then all classes matched */jsfunit/.java would be compiled but only if i touch them!

Please help!

Thanx in advance

A: 

To exclude files from the default-testCompile phase, you have to use <testExcludes>. So your example above would look like so:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <source>1.6</source>
    <target>1.6</target>
  </configuration>
  <executions>
    <execution>
      <id>default-testCompile</id>
      <phase>test-compile</phase>
      <configuration>
        <testExcludes>
          <exclude>**/jsfunit/*.java</exclude>
        </testExcludes>
      </configuration> 
      <goals>
        <goal>testCompile</goal>
      </goals>
    </execution>                  
  </executions>
</plugin>
samskivert