Maven原型问题

时间:2011-05-18 11:36:40

标签: maven maven-plugin maven-archetype

我是maven的新手。我在我的机器上安装了apache archiva以用作maven-proxy。我的目的是我想使用maven archiva插件生成一个示例项目结构。我已经使用archiva上传了所需的工件。

当我运行mvn archetype时:生成它应该问我剩下的参数。但相反,它给了我以下错误。这表明我的意思是maven共享插件。但我也使用archiva上传了maven共享插件工件。

这是堆栈跟踪

F:\MavenTests\simple>mvn archetype:generate 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Stub Project (No POM) 1 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> maven-archetype-plugin:2.0:generate (default-cli) @ standalone-pom >>> 
[INFO] 
[INFO] <<< maven-archetype-plugin:2.0:generate (default-cli) @ standalone-pom <<< 
[INFO] 
[INFO] --- maven-archetype-plugin:2.0:generate (default-cli) @ standalone-pom --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.276s 
[INFO] Finished at: Wed May 18 17:11:05 ALMT 2011 
[INFO] Final Memory: 3M/15M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.0:generate (default-cli) on project standalone-pom: Exe 
lugins:maven-archetype-plugin:2.0'. A required class is missing: org/apache/maven/shared/invoker/MavenInvocationException 
[ERROR] ----------------------------------------------------- 
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-archetype-plugin:2.0 
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 
[ERROR] urls[0] = file:/C:/Users/mae/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/2.0/maven-archetype-plugin-2.0.jar 
[ERROR] urls[1] = file:/C:/Users/mae/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar 
[ERROR] Number of foreign imports: 4 
[ERROR] import: Entry[import org.codehaus.plexus.util.xml.pull.XmlSerializer from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.util.xml.pull.XmlPullParserException from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.util.xml.pull.XmlPullParser from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.util.xml.Xpp3Dom from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] 
[ERROR] realm =    maven.api 
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy 
[ERROR] Number of foreign imports: 21 
[ERROR] import: Entry[import org.sonatype.aether from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.personality from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.logging from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.lifecycle from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.context from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.container from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.configuration from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.component from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.classworlds from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.PlexusContainerException from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.PlexusContainer from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.PlexusConstants from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.MutablePlexusContainer from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.DuplicateChildContainerException from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.DefaultPlexusContainer from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.DefaultContainerConfiguration from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.DefaultComponentRegistry from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.ContainerConfiguration from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.plexus.ComponentRegistry from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.codehaus.classworlds from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] import: Entry[import org.apache.maven from realm ClassRealm[plexus.core, parent: null]] 
[ERROR] 
[ERROR] -----------------------------------------------------: org.apache.maven.shared.invoker.MavenInvocationException 
[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/PluginContainerException

我在这里偶然发现了。任何形式的帮助都将受到高度赞赏。

1 个答案:

答案 0 :(得分:5)

正如help link所指出的,看起来你可能有一个腐败的jar,在本例中是maven-invoker-2.0.x.jar。您可以检查本地存储库并对其进行验证,如果需要,请将其删除并重试。

你的archiva本身也可能有腐败的jar,你需要在那里删除它。