This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes maven build error which is strange Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "maven build error which is strange" Watch "maven build error which is strange" New topic

maven build error which is strange

ashok kumar bommisetty

Joined: Nov 23, 2010
Posts: 1
The below is the maven error I get when i try to execute few test cases in selenium. The error says annotations do not work in 1.3 version but i do not have 1.3 in my system . I have a java version 1.6

C:\Documents and Settings\bomma\workspace\SeleniumControls>mvn clean install -e
-P test-severity-1 -Dtest=**/Test*.java
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Pega UI Testing Framework
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory C:\Documents and Settings\bomma\workspace\SeleniumCont
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Documents and Settings\bomma\works
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 6 source files to C:\Documents and Settings\bomma\workspace\Sel
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

C:\Documents and Settings\bomma\workspace\SeleniumControls\src\main\java\com\peg
a\prpc\api\testcase\[26,2] annotations are not
supported in -source 1.3
(use -source 5 or higher to enable annotations)

C:\Documents and Settings\bomma\workspace\SeleniumControls\src\main\java\com\peg
a\prpc\api\testcase\[78,14] for-each loops are
not supported in -source 1.3
(use -source 5 or higher to enable for-each loops)
for (char c : LoadPropertyFile.getProperty("prpc.userlogin").toC

C:\Documents and Settings\bomma\workspace\SeleniumControls\src\main\java\com\peg
a\prpc\api\testcase\[3,7] static import declarations are n
ot supported in -source 1.3
(use -source 5 or higher to enable static import declarations)
import static org.junit.Assert.assertEquals;

C:\Documents and Settings\bomma\workspace\SeleniumControls\src\main\java\com\peg
a\prpc\api\testcase\[17,2] annotations are not supported i
n -source 1.3
(use -source 5 or higher to enable annotations)

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Compilation failure
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
at org.apache.maven.DefaultMaven.doExecute(
at org.apache.maven.DefaultMaven.execute(
at org.apache.maven.cli.MavenCli.main(
at org.apache.maven.cli.compat.CompatibleMain.main(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
at java.lang.reflect.Method.invoke(
at org.codehaus.classworlds.Launcher.launchEnhanced(
at org.codehaus.classworlds.Launcher.launch(
at org.codehaus.classworlds.Launcher.mainWithExitCode(

at org.codehaus.classworlds.Launcher.main(
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation fail
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompiler
at org.apache.maven.plugin.CompilerMojo.execute(
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
... 17 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Nov 23 19:25:30 IST 2010
[INFO] Final Memory: 14M/26M
[INFO] ------------------------------------------------------------------------

Check out the java version displayed when i am trying to see the mvn version...

C:\Documents and Settings\bomma\workspace\SeleniumControls>mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-07 00:46:01+0530)
Java version: 1.6.0_06
Java home: C:\Program Files\Java\jdk1.6\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

Thanks in advance

Peter Johnson

Joined: May 14, 2008
Posts: 5852

Maven does not care what version of JDK you are using, it always assumes 1.3 unless you tell it otherwise. You need to specify the source and target as being 1.5 or 1.6. Add this under <build>:

JBoss In Action
subject: maven build error which is strange
It's not a secret anymore!