Two Guys Arguing

Maven! Leeggo My Eggo (tests)

Posted in Uncategorized by benjaminplee on 07.23.09

Warning: venting of frustration has commenced.

I ran into a huge problem today.  While trying to find a temporary workarond, I found a much more confusing problem.

While setting up another team’s project in Maven/Continuum, I found that they had a package of Java code which wouldn’t compile (some external API had changed).  This is not good at all b/c A) their code doesn’t work right now and B) it is committed that way to SVN.  For the time being, the idea crossed my mind to modify their pom.xml so that Maven just wouldn’t compile/test the offending package which would at least keep things moving from an infrastructure setup point of view.

A couple quick tries, a few google searches, a few more tries, and a lot of confusion later and I still can’t get Maven’s compiler plugin to ignore any or all of my tests.  Despite what looks to be an exact example of what I want on the plugin’s site here, and a mailing list post here, I doesn’t work.

Modifying the plugin’s main configuration only works to exclude classes from the main source folder.  This is also true if you move the configuration to the “default-compile” execution.  BUT, if you move it to the “default-testCompile” execution, nothing happens.  Ignored.  If I change the configuration to force the tests to be output in Java 1.4 code, it errors b/c they contain annotatoins (what you would expect) but the <excludes> is ignored like it was never there.

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-compiler-plugin</artifactId>
 <executions>
 <execution>
 <id>default-testCompile</id>
 <configuration>
 <excludes>
 <exclude>**/*.*</exclude>
 </excludes>
 </configuration>
 </execution>
 </executions>
 <configuration>
 <source>1.5</source>
 <target>1.5</target>
 </configuration>
 </plugin>

^^^ Doesn’t work
Very strange and annoying.

If anyone has any thoughts or ideas, please let me know.  If I ever figure out definitely what is going on, I will post what I find here.

At least I am not alone.

Follow

Get every new post delivered to your Inbox.