Monday, February 21, 2011

Resolving invalid target release error, java maven build

After running mvn install -DskipTests=true command
I got following error:

[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------------
---
[INFO] Building visitplanning
[INFO]    task-segment: [install]
[INFO] -------------------------------------------------------------------------
---
[INFO] Ignoring available plugin update: 2.3.2 as it requires Maven version 2.0.
9
[INFO] Ignoring available plugin update: 2.3.1 as it requires Maven version 2.0.
9
[INFO] Ignoring available plugin update: 2.3 as it requires Maven version 2.0.9
[INFO] Ignoring available plugin update: 2.2 as it requires Maven version 2.0.9
[INFO] Ignoring available plugin update: 2.1 as it requires Maven version 2.0.9
[INFO] Ignoring available plugin update: 2.7.2 as it requires Maven version 2.0.
9
[INFO] Ignoring available plugin update: 2.7.1 as it requires Maven version 2.0.
9
[INFO] Ignoring available plugin update: 2.7 as it requires Maven version 2.0.9
[INFO] Ignoring available plugin update: 2.6 as it requires Maven version 2.0.9
[INFO] Ignoring available plugin update: 2.5 as it requires Maven version 2.0.9
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Workspace\XXXXXXXX\src\main\resourc
es
[INFO] [compiler:compile]
[INFO] Compiling 37 source files to D:\Workspace\XXXXXXXX\target\classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.6

The solution was pretty simple. Maven uses JAVA_HOME environment variable and by changing it to point to JDK 1.6 the error was resolved.

No comments: