Maven: What the hell is wrong with it?

Maven is a build tool that succeeds Ant. However, despite the productive gains in terms of dependency management, it's a real turkey when something goes wrong.

Typical daily issue with Maven follows…

I run the JBossCache test suite, and this is what I get:


$ mvn test
[INFO] Scanning for projects...
WAGON_VERSION: 1.0-beta-2
[INFO] ----------------------------------------------------------------------------
[INFO] Building JBoss Cache - Core Edition
[INFO]    task-segment: [test]
[INFO] ----------------------------------------------------------------------------
...
[INFO] [surefire:test]
[INFO] Surefire report directory: c:srcworkspaceJBossCacheSvntargetsurefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16 seconds
[INFO] Finished at: Fri Aug 24 11:54:58 PDT 2007
[INFO] Final Memory: 11M/20M
[INFO] ------------------------------------------------------------------------

Tests don't run. Nothing output, fair enough.

I run with the -e switch and get:


[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: There are test failures.
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:560)
...
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.
        ... 16 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15 seconds
[INFO] Finished at: Fri Aug 24 11:58:55 PDT 2007
[INFO] Final Memory: 11M/20M
[INFO] ------------------------------------------------------------------------

This is not much more information. The "target/surefire-reports" directory does not exist, so it ran no tests. So, if no tests were run, how could there have been errors?

And, what the hell did it do for 15 seconds? There's no output, no debug logs preceding or following, and I have no clue what happened.

Google found me this: http://jira.codehaus.org/browse/SUREFIRE-339 . The issue suggests some sort of configuration issue: I tried adding explicit "includes" and I'm sure I'm not naming my directories using Swedish characters. None of this information helped at all.

The test component, and a lot of other Maven tools bomb out in this way. NullPointerExceptions and other mysterious failures are quite frequent if you forget a parameter or configuration key. And a lot of plug-ins don't have much, if any documentation. The rule is: If your program accepts user input, it should check every single piece of information. Of course, I've been somewhat guilty of not doing this some of the time, but at least my errors have the decency to provide a line number.

In this case, I expect, somebody is truncating the exception, so I'll never see the line number. It's not logged using the  -X option, either, and I'm off to find out if there's any "secret" debug logs I can get at.

In addition to bugs like this, in general Maven does a lot of network access. So in addition to the slow start-up time, every run accesses about 5-6 HTTP resources. These resources have not changed and will not (likely) change every time I run the command. So I'm also off to hunt for a "stop accessing the server" option as well.

Read and post comments | Send to a friend

Advertisements

About eliasross

Blogging before the word "blog" was invented.
This entry was posted in Uncategorized. Bookmark the permalink.

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