运行" mvn clean install"

时间:2014-12-19 09:11:46

标签: java eclipse maven spring-mvc

我使用以下代码创建项目。 (I followed this tutorial

git clone https://github.com/kolorobot/spring-mvc-quickstart-archetype.git
cd spring-mvc-quickstart-archetype
mvn clean install

而且,当我尝试mvn clean install时,我收到以下错误消息。

[INFO] [INFO] 1 error
[INFO] [INFO] -------------------------------------------------------------
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 6.844 s
[INFO] [INFO] Finished at: 2014-12-19T14:28:09+05:30
[INFO] [INFO] Final Memory: 11M/111M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project basic: Compilation failure
[INFO] [ERROR] Failure executing javac, but could not parse the error:
[INFO] [ERROR] javac: invalid target release: 1.8
[INFO] [ERROR] Usage: javac <options> <source files>
[INFO] [ERROR] use -help for a list of possible options
[INFO] [ERROR] -> [Help 1]
[INFO] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project basic: Compilation failure
[INFO] Failure executing javac, but could not parse the error:
[INFO] javac: invalid target release: 1.8
[INFO] Usage: javac <options> <source files>
[INFO] use -help for a list of possible options
[INFO] 
[INFO] 
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[INFO] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[INFO] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
[INFO] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
[INFO] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
[INFO] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
[INFO] at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:606)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[INFO] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
[INFO] Failure executing javac, but could not parse the error:
[INFO] javac: invalid target release: 1.8
[INFO] Usage: javac <options> <source files>
[INFO] use -help for a list of possible options
[INFO] 
[INFO] 
[INFO] at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
[INFO] at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
[INFO] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[INFO] ... 19 more
[INFO] [ERROR] 
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR] 
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[INFO] Post-archetype-generation invoker exit code: 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.726 s
[INFO] Finished at: 2014-12-19T14:28:10+05:30
[INFO] Final Memory: 13M/115M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:integration-test (default-integration-test) on project spring-mvc-quickstart:
[ERROR] Archetype IT 'basic' failed: Execution failure: exit code = 1
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

你需要jdk 8来编译项目。(路径中的pom文件:“ spring-mvc-quickstart-archetype / src / main / resources / archetype-resources / pom.xml ”强迫你安装了jdk 8。