Mvn 错误 FATAL ERROR: Unable to start the embedded plexus container

mvn运行出现如下错误。C:\Documents and Settings\YUCHENGHU>mvn FATAL ERROR: Unable to start the embedded plexus container For more information, run with the -e flag C:\Documents and Settings\YUCHENGHU>[attach]861[/attach]

可以用打开错误提示的方式来查看错误的原因。[code]C:\Documents and Settings\YUCHENGHU>mvn -e flag

  • Error stacktraces are turned on.
    FATAL ERROR: Unable to start the embedded plexus container
    Error stacktrace:
    org.codehaus.plexus.PlexusContainerException: Error starting container
    at org.codehaus.plexus.DefaultPlexusContainer.start(DefaultPlexusContain
    er.java:795)
    at org.codehaus.plexus.embed.Embedder.start(Embedder.java:220)
    at org.codehaus.plexus.embed.Embedder.start(Embedder.java:183)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:167)
    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.codehaus.plexus.component.repository.exception.ComponentRepositor
yException: Component descriptor role: ‘org.apache.maven.wagon.CommandExecutor’,
implementation: ‘org.apache.maven.wagon.providers.ssh.external.ScpExternalComma
ndExecutor’, role hint: ‘scpexe’ has a hint, but there are other implementations
that don’t
at org.codehaus.plexus.component.repository.DefaultComponentRepository.a
ddComponentDescriptor(DefaultComponentRepository.java:184)
at org.codehaus.plexus.DefaultPlexusContainer.addComponentDescriptor(Def
aultPlexusContainer.java:515)
at org.codehaus.plexus.DefaultPlexusContainer.discoverComponents(Default
PlexusContainer.java:738)
at org.codehaus.plexus.DefaultPlexusContainer.start(DefaultPlexusContain
er.java:779)
… 11 more
C:\Documents and Settings\YUCHENGHU>[/code]出现错误的原因是mvn的版本不匹配。

通过查看版本的命令来查看当前的mvn版本,现在可以知道2.0.11的mvn版本和 JDK 1.6的版本不兼容。可以试着用最新的mvn版本替换。C:\Documents and Settings\YUCHENGHU>mvn -v Apache Maven 2.0.11 (r909250; 2010-02-12 00:55:50-0500) Java version: 1.6.0_11 Java home: C:\Program Files\Java\jdk1.6.0_11\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows" C:\Documents and Settings\YUCHENGHU>