maven-compiler-plugin exclude
31,601
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>
Related videos on Youtube
Author by
easyrider
Updated on August 28, 2020Comments
-
easyrider over 3 years
I have a following problem. I would like to exclude some .java files (**/jsfunit/*.java) during the test-compile phase and on the other side I would like to include them during the compile phase (id i start tomcat 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!
-
Devanshu Mevada almost 14 yearsWhat is the exact path for jsfunit files (relative to
${basedir}
)? -
easyrider almost 14 yearssrc/main/java/de/hska/repo/ui/jsfunit
-
Devanshu Mevada almost 14 yearsI don't understand.
compiler:testCompile
compiles application test sources (i.e. test sources undersrc/test/main
) so there is nothing to exclude. What is the problem exactly? What are you trying to solve? -
easyrider almost 14 yearsHmm.. you are right. My problem is: jsfunit uses junit3, but our junit tests use junit4. in pom.xml i can't include junit3 and junit4 dependencies and if i try to run junit tests the compiler fails to compile files from jsfunit/package 'cause there only junit4 in classpath(but not junit3)
-
easyrider almost 14 yearsbut i need the classes from jsfunit package if i run tomcat:run goal
-
xverges over 9 yearsAlso keep in mind that the path doesn't have to include
src/test/java
. See stackoverflow.com/a/19713000/239408 -
Anant Laxmikant Bobde over 7 yearsA superb description about your issue can be found here. stackoverflow.com/questions/2593588/…here
-