Wednesday, December 19, 2012

Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: Error creating properties files for forking; nested exception is java.io.IOException: Invalid argument

Maven Error

This error is not consistent, you can have mvn install run fine then randomly it fails. This makes you think you caused the error as part of your code iteration process.

These types of errors waste enormous amounts of time because they can't be pinpointed to the root cause using a simple web search.


Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.6:test (default-test) on project

Error creating properties files for forking; nested exception is java.io.IOException: Invalid argument -> [Help 1]

This error message is of course totally useless.

One clue for what it is trying to do comes from running mvn -e install


Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: Error creating properties files for forking; nested exception is java.io.IOException: Invalid argument

Only says Maven is trying to write to the file system.



The clue for the fix comes from this Maven Jira ticket which is only relevant to Maven 2.6:
http://jira.codehaus.org/browse/SUREFIRE-573


This error wastes a lot of time because of the poor visibility of the internal state to the UI.

And the error messages aren't consistent every time you run Maven.

Just depends on when maven needs to write to the property file. This doesn't happen on every incremental build.


mvn doesn't list where the properties file it is trying to create is supposed to be .This only holds for maven 2.6 and goes away  for maven 2.7.

Change the pom.xml to 2.7

From this:



org.apache.maven.plugins
maven-surefire-plugin
2.6


to this:



org.apache.maven.plugins
maven-surefire-plugin
2.7






No comments:

Post a Comment