aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
Author

maven build error which is strange

ashok kumar bommisetty
Greenhorn

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
rols\target
[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
pace\SeleniumControls\src\main\resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 6 source files to C:\Documents and Settings\bomma\workspace\Sel
eniumControls\target\classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

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

C:\Documents and Settings\bomma\workspace\SeleniumControls\src\main\java\com\peg
a\prpc\api\testcase\SeleniumTestBaseApplication.java:[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
harArray()){

C:\Documents and Settings\bomma\workspace\SeleniumControls\src\main\java\com\peg
a\prpc\api\testcase\SeleniumTestBase.java:[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\SeleniumTestBase.java:[17,2] annotations are not supported i
n -source 1.3
(use -source 5 or higher to enable annotations)
@BeforeClass


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Compilation failure
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:715)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6
0)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation fail
ure
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompiler
Mojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:694)
... 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
-Ashok

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

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
 
wood burning stoves
 
subject: maven build error which is strange