3

我是 Maven 的新手。我尝试执行 >mvn eclipse:eclipse -Dwtpversion=2.0。但我得到以下错误:

  D:\test\CounterWebApp>mvn eclipse:eclipse -Dwtpversion=2.0
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building CounterWebApp Maven Webapp 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] >>> maven-eclipse-plugin:2.9:eclipse (default-cli) @ CounterWebApp >>>
    [INFO]
    [INFO] --- maven-dependency-plugin:2.1:copy-dependencies (copy-dependencies) @ C
    ounterWebApp ---
    [INFO] junit-3.8.1.jar already exists in destination.
    [INFO]
    [INFO] <<< maven-eclipse-plugin:2.9:eclipse (default-cli) @ CounterWebApp <<<
    [INFO]
    [INFO] --- maven-eclipse-plugin:2.9:eclipse (default-cli) @ CounterWebApp ---
    28 Feb, 2013 1:01:48 PM org.sonatype.guice.bean.reflect.Logs$JULSink warn
    WARNING: Error injecting: org.apache.maven.plugin.eclipse.EclipsePlugin
    java.lang.NoClassDefFoundError: org/codehaus/plexus/resource/loader/ResourceNotF
    oundException
            at java.lang.Class.getDeclaredConstructors0(Native Method)
            at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
            at java.lang.Class.getDeclaredConstructors(Class.java:1836)
            at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.
    java:245)
            at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorB
    indingImpl.java:98)
            at com.google.inject.internal.InjectorImpl.createUninitializedBinding(In
    jectorImpl.java:629)
            at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(Injec
    torImpl.java:831)
            at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecurs
    ive(InjectorImpl.java:758)
            at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(Injector
    Impl.java:255)
            at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImp
    l.java:204)
            at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorIm
    pl.java:954)
            at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java
    :987)
            at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java
    :950)
            at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java
    :1000)
            at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDef
    erredClass.java:45)
            at com.google.inject.internal.ProviderInternalFactory.provision(Provider
    InternalFactory.java:84)
            at com.google.inject.internal.InternalFactoryToInitializableAdapter.prov
    ision(InternalFactoryToInitializableAdapter.java:52)
            at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInt
    ernalFactory.java:70)
            at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
    rovision(ProvisionListenerStackCallback.java:100)
            at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvisi
    on(PlexusLifecycleManager.java:138)
            at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
    rovision(ProvisionListenerStackCallback.java:108)
            at com.google.inject.internal.ProvisionListenerStackCallback.provision(P
    rovisionListenerStackCallback.java:55)
            at com.google.inject.internal.ProviderInternalFactory.circularGet(Provid
    erInternalFactory.java:68)
            at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(
    InternalFactoryToInitializableAdapter.java:45)
            at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:96
    5)
            at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.ja
    va:1011)
            at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
            at com.google.inject.Scopes$1$1.get(Scopes.java:59)
            at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry
    .java:83)
            at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexus
    Bean.java:49)
            at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
    ner.java:253)
            at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
    ner.java:245)
            at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfigu
    redMojo(DefaultMavenPluginManager.java:455)
            at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
    BuildPluginManager.java:92)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:209)
            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.buildProje
    ct(LifecycleModuleBuilder.java:84)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:59)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
    ild(LifecycleStarter.java:183)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
    eStarter.java:161)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            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:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.resource.loader
    .ResourceNotFoundException
            at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
    SelfFirstStrategy.java:50)
            at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
    .java:244)
            at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
    .java:230)
            ... 54 more
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.106s
    [INFO] Finished at: Thu Feb 28 13:01:48 IST 2013
    [INFO] Final Memory: 6M/15M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.9
    :eclipse (default-cli) on project CounterWebApp: Execution default-cli of goal o
    rg.apache.maven.plugins:maven-eclipse-plugin:2.9:eclipse failed: A required clas
    s was missing while executing org.apache.maven.plugins:maven-eclipse-plugin:2.9:
    eclipse: org/codehaus/plexus/resource/loader/ResourceNotFoundException
    [ERROR] -----------------------------------------------------
    [ERROR] realm =    plugin>org.apache.maven.plugins:maven-eclipse-plugin:2.9
    [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
    [ERROR] urls[0] = file:/D:/M2_REPO/org/apache/maven/plugins/maven-eclipse-plugin
    /2.9/maven-eclipse-plugin-2.9.jar
    [ERROR] urls[1] = file:/D:/M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar
    [ERROR] urls[2] = file:/D:/M2_REPO/org/apache/maven/reporting/maven-reporting-ap
    i/2.0.8/maven-reporting-api-2.0.8.jar
    [ERROR] urls[3] = file:/D:/M2_REPO/org/apache/maven/doxia/doxia-sink-api/1.0-alp
    ha-9/doxia-sink-api-1.0-alpha-9.jar
    [ERROR] urls[4] = file:/D:/M2_REPO/commons-cli/commons-cli/1.0/commons-cli-1.0.j
    ar
    [ERROR] urls[5] = file:/D:/M2_REPO/org/codehaus/plexus/plexus-interactivity-api/
    1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
    [ERROR] urls[6] = file:/D:/M2_REPO/commons-io/commons-io/1.4/commons-io-1.4.jar
    [ERROR] urls[7] = file:/D:/M2_REPO/org/codehaus/plexus/plexus-archiver/1.0-alpha
    -7/plexus-archiver-1.0-alpha-7.jar
    [ERROR] urls[8] = file:/D:/M2_REPO/org/codehaus/plexus/plexus-utils/1.5.6/plexus
    -utils-1.5.6.jar
    [ERROR] urls[9] = file:/D:/M2_REPO/org/codehaus/plexus/plexus-interactivity-jlin
    e/1.0-alpha-5/plexus-interactivity-jline-1.0-alpha-5.jar
    [ERROR] urls[10] = file:/D:/M2_REPO/jline/jline/0.9.1/jline-0.9.1.jar
    [ERROR] urls[11] = file:/D:/M2_REPO/org/apache/maven/maven-archiver/2.2/maven-ar
    chiver-2.2.jar
    [ERROR] urls[12] = file:/D:/M2_REPO/org/codehaus/plexus/plexus-resources/1.0-alp
    ha-7/plexus-resources-1.0-alpha-7.jar
    [ERROR] urls[13] = file:/D:/M2_REPO/biz/aQute/bndlib/0.0.145/bndlib-0.0.145.jar
    [ERROR] urls[14] = file:/D:/M2_REPO/org/apache/maven/shared/maven-osgi/0.2.0/mav
    en-osgi-0.2.0.jar
    [ERROR] urls[15] = file:/D:/M2_REPO/org/eclipse/core/resources/3.3.0-v20070604/r
    esources-3.3.0-v20070604.jar
    [ERROR] Number of foreign imports: 1
    [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
    [ERROR]
    [ERROR] -----------------------------------------------------: org.codehaus.plex
    us.resource.loader.ResourceNotFoundException
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
    ch.
    [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 rea
    d the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

我正在关注教程:http ://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/ 。

请让我知道如何解决该错误。

4

4 回答 4

1

用于 maven-eclipse-plugin:2.9:eclipse 和 web 项目使用

mvn 日食:清洁

mvn eclipse:eclipse -Dwtpversion=2.0

更新项目

于 2014-03-05T08:58:51.223 回答
0

运行“mvn 全新安装”

然后'mvn eclipse:eclipse'

于 2013-11-26T04:19:35.453 回答
0

试试下面的,它在朱诺上对我有用

mvn eclipse:eclipse -Dwtpversion=1.5
于 2013-07-02T08:49:00.283 回答
0

我只是分享我的 Maven 配置详细信息,它可能会有所帮助:

如果您使用的是嵌入式 eclipse 插件,那么使用外部 maven 安装是个好主意。 您可以在窗口 -> 首选项 -> maven -> 安装下查看插件详细信息

我有几个嵌入式问题。所以你可以从http://maven.apache.org/download.cgi下载 maven 。

在 Eclipse 中进行以下更改:窗口 -> 首选项 -> maven -> 安装 -> 添加 -> 外部一个窗口 -> 首选项 -> maven -> 用户设置 -> 从外部提供 conf/settings.xml 的路径

保持本地存储库与嵌入式存储库相同。它可以解决配置问题。

于 2013-03-06T15:45:00.100 回答