maven org.apache.maven.lifecycle.LifecycleExecutionException

今日在做maven项目部署时出现了这样一个错误,开始时不得要领总以为某个plugin找不到了或是版本不对:

 

于是重装maven。。。

 

mvn -install -e

 

问题依旧

 

后来查看%MAVEN_HOME%/conf/settings.xml时发现:

 

E:/local_repo/repository中指向的目录出了问题(原来目录放在.m2中的后来给挪了一下位置,也许是覆盖掉的吧,谁知道?),

于是将其改为%MAVEN_HOME%/.m2/repository

 

问题解决!

 

总结一下:

 

1. 确保正确安装maven。(通常跳过此步。。。)。

2. 确保相关的环境变量存在(M2_HOME、 MAVEN_HOME等)。

3. 确保settings.xml中的库目录指向正确的地址。

4. 如果还是不行就完全删掉maven,然后参照第1条。

 

相关信息:

+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building dongao Bussiness Operation Support System
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could be found
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.Java:1286)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1522)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindLifecycleForPackaging(DefaultLifecycleExecutor.java:1016)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:980)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        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.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-resources-plugin' does not exist or no valid version could
e found
        at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229)
        at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91)
        at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:167)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1257)
        ... 18 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Mar 10 16:11:26 CST 2009
[INFO] Final Memory: 1M/3M
[INFO] ------------------------------------------------------------------------

 

 

为了方便找错,通常在使用maven的时候都是离线模式(当然第一次安装要在线的,除非你又本地库了)加错误输出,比如:

mvn package -e -o -Dmaven.test.skip=true 将某个工程编译打包

 

-e --errors:打开错误输出

-o --offline:离线模式

 

当然还有:-h 那个就是帮助了。

你可能感兴趣的:(maven)