Maven构建错误失败

时间:2012-09-11 06:55:46

标签: maven

如下所示,我在运行mvn package

时遇到错误
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project hello-world: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar failed: Unable to load the mojo 'jar' in the plugin 'org.apache.maven.plugins:maven-jar-plugin:2.3.1'. A required class is missing: org/codehaus/plexus/components/io/resources/PlexusIoResourceCollection
    [ERROR] -----------------------------------------------------
    [ERROR] realm =    plugin>org.apache.maven.plugins:maven-jar-plugin:2.3.1
    [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
    [ERROR] urls[0] = file:/C:/maven/repository/org/apache/maven/plugins/maven-jar-plugin/2.3.1/maven-jar-plugin-2.3.1.jar
    [ERROR] urls[1] = file:/C:/maven/repository/junit/junit/3.8.1/junit-3.8.1.jar
    [ERROR] urls[2] = file:/C:/maven/repository/org/apache/maven/maven-archiver/2.4.1/maven-archiver-2.4.1.jar
    [ERROR] urls[3] = file:/C:/maven/repository/org/codehaus/plexus/plexus-archiver/1.0/plexus-archiver-1.0.jar
    [ERROR] urls[4] = file:/C:/maven/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
    [ERROR] urls[5] = file:/C:/maven/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
    [ERROR] Number of foreign imports: 1
    [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
    [ERROR] 
    [ERROR] -----------------------------------------------------: org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection
    [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

这是我的pom.xml。我摆脱了不必要的东西,但它仍然不起作用..

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>sds.jetty.simple</groupId>
<artifactId>hello-world</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>Jetty HelloWorld</name>

<properties>
    <jettyVersion>8.1.2.v20120308</jettyVersion>
</properties>

<dependencies>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-server</artifactId>
        <version>${jettyVersion}</version>
    </dependency>
</dependencies>

<build>
</build>
</project>

请帮帮我。

11 个答案:

答案 0 :(得分:5)

尝试删除到文件夹

.m2\repository\org\apache\maven\plugins\maven-jar-plugin

在您的文件系统上。您的插件jar可能已损坏。

如果这不起作用,请尝试删除jetty-server文件夹(同样的原因)

答案 1 :(得分:1)

我遇到过类似的问题一次。事实证明这是一个maven 3问题。切换到maven 2.2.1后,我的构建运行正常。

答案 2 :(得分:1)

即使遇到这个问题。只需删除.m2 / repository文件夹并再次构建Project即可解决此问题。

答案 3 :(得分:0)

对于您的示例POM文件,working for me,问题应该在其他地方。

你确定那里没有连接问题吗?您的antivirii软件不会阻止您下载工件?您的本地存储库中的条目是否已损坏?

答案 4 :(得分:0)

对于我们来说,这是因为Eclipse / Maven自动将我们的JDK更改为1.5(从1.8)。手动更改回1.8修复了问题。

答案 5 :(得分:0)

这是Maven 3.3.1和3.3.3中尚未解决的问题; https://issues.apache.org/jira/browse/MNG-5787 我升级到3.3.9并开始工作。

答案 6 :(得分:0)

我最近遇到了这个问题,我只需要从.m2 / repository中删除文件夹并重新运行pom。它奏效了。

答案 7 :(得分:0)

在依赖项中应该存在一些问题,Maven无法即时解决。 尝试在项目根目录上运行此命令。


Dim WS As Worksheet
Set WS = ThisWorkbook.Sheets("Blad1")

Dim rcell As Range, rng As Range
Set rng = WS.Range("G2:G" & WS.UsedRange.Rows.Count)
For Each rcell In rng.Cells

If InStrFunc(Range(rcell.Address), "2528", "2529", "2530", "2531", "2532", "2533",
"2534", "2535", "2536", "2537", "2573", "2574") Then
   rcell.Offset(, 1) = "Group 1"
   Else: rcell.Offset(, 1) = "Group 2"
End If

Next rcell

End Sub

这应该解决所有依赖性问题,并帮助您运行应用程序

答案 8 :(得分:0)

1。我建议您完全删除.m2文件夹

2。然后行maven->更新项目。

3.Maven安装

答案 9 :(得分:0)

我在使用 Maven 3.6.3 版时遇到了同样的错误。就我而言,这不是 maven 的问题。但是我在 src/resource 文件夹中异常复制了一个非常大的文件夹(5 GB)。删除垃圾文件夹后,一切正常。

答案 10 :(得分:0)

使用 Java 8 而不是 Java 6 进行编译已经解决了我的问题。

相关问题