4

I am working on Spring MVC [google app engine]. My project is built on 1.6 Java SDK previously now I wanted to switch to Java SDK 1.7.

I have made all changes for updating to JAVA 1.7 SDK.

I have made changes in pom.xml File [I have commented old 1.6 SDK code]

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>2.0</version>
  <configuration>
<!--<executable>C:/Program Files/Java/jdk1.6.0/bin/javac</executable> -->
<!--<source>1.6</source> -->
<!--<target>1.6</target> -->
    <executable>C:/Program Files/Java/jdk1.7.0_45/bin/javac</executable>
    <source>1.7</source>
    <target>1.7</target>
  </configuration>
</plugin>

But when using Maven install command I am getting exception as

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0:compile

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0:compile (default-compile) on project: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:429)
    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:110)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more

Any help on this please. My environment:

Apache Maven 3.0.2 (r1056850; 2011-01-09 06:28:10+0530) 
Java version: 1.7.0_45, vendor: Oracle Corporation 
Java home: C:\Program Files\Java\jdk1.7.0_45\jre 
Default locale: en_US, platform encoding: Cp1252 
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
Swap L
  • 698
  • 3
  • 12
  • 27
  • You should post more of the maven output. That one line isn't telling us anything. – Steven Pessall Mar 28 '14 at 08:27
  • @StevenPessall i am only getting Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0:compile (default-compile) on project : Compilation failure: Compilation failure: – Swap L Mar 28 '14 at 08:29
  • Which version of maven are you using? – Steven Pessall Mar 28 '14 at 08:29
  • and some times javac excution fails – Swap L Mar 28 '14 at 08:29
  • Try running with a `-X` flag to produce debug output. The output will be large, so pipe it to a file and look through the last past for any interesting stack traces and errors. – Duncan Jones Mar 28 '14 at 08:32
  • Apache Maven 3.0.2 (r1056850; 2011-01-09 06:28:10+0530) Java version: 1.7.0_45, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.7.0_45\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "x86", family: "windows" – Swap L Mar 28 '14 at 08:33
  • 1
    If the compilation fails the output for the actual compile errors is located after the line `[ERROR] COMPILATION ERROR :`. Does your output contain that line? – Steven Pessall Mar 28 '14 at 08:34
  • @StevenPessall yes, it is compiling.Some time it is showing me javac excuting error – Swap L Mar 28 '14 at 08:41
  • Well, which javac errors is it showing? – Steven Pessall Mar 28 '14 at 08:43
  • 1
    To all files error showing : could not parse error message: symbol: class Table [ERROR]import javax.persistence.ManyToOne; ^ – Swap L Mar 28 '14 at 08:47
  • @SwapL For the avoidance of doubt, can you copy/paste the lines that Steven is referring to and add them to your question. – Duncan Jones Mar 28 '14 at 09:00
  • 2
    Are you sure you are using Maven 3? There is a problem with Maven 2 and Java 7, which results in the error message you gave. For more info see here: http://stackoverflow.com/questions/9298146/maven-could-not-parse-error-message-java-7-maven-2 – Steven Pessall Mar 28 '14 at 09:05
  • mnv --version giving above mention version ... how i can check this out. I am MAVEN beginner. Can you tell what should i do to check this. – Swap L Mar 28 '14 at 09:17
  • 1
    Sounds like you are really using maven 3. Have you tried updating the version of the compiler plugin? 2.0.0 is pretty old. – Steven Pessall Mar 28 '14 at 09:30
  • i tried that too same error – Swap L Mar 28 '14 at 10:58
  • Can you try adding `true` before `` tag? Also refer to [this related question](http://stackoverflow.com/questions/20218486/unable-to-build-using-maven-with-error-failed-to-execute-goal-org-apache-maven) – Raghuram Mar 28 '14 at 12:54
  • Wait, you write that you use the `mvn install` command. Did you perform a `mvn clean` since switching to java 1.7? If not you may be mixing java 1.6 and 1.7 classes. – Steven Pessall Mar 28 '14 at 13:46
  • yes clean got successful but install is not @StevenPessall – Swap L Mar 28 '14 at 14:16

0 Answers0