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.

About these ads

2 Responses

Subscribe to comments with RSS.

  1. Jeff said, on 10.07.09 at 3:50 pm

    Did you ever figure this out? I stumbled across your post while looking to do the same. I got it to work by including both the and nodes of a configuration tag within the maven-compiler-plugin.

    Hopefully you already figured this out.
    -Jeff

    sample (please note I have a parent pom with more plugin details defined for the compiler so if you notice things are missing (compiler level) that’s why):

    org.apache.maven.plugins
    maven-compiler-plugin

    [java source file]

    src/test/**/*.java

  2. Jeff said, on 10.07.09 at 3:51 pm

    my post removed all of my xml. you use the excludes and testExcludes tags within the configuration node.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.