未能解析org. apache.mavenins .plugins:maven-resources-plugin:2.4.3.插件的插件描述符。打开zip文件时出错

时间:2021-05-03 17:18:59

I was using maven to build and compile a spring project and here's what I got an error about "error in opening zip file.". I attached the settings.xml here to show that I configured the proxy right and the pom.xml.

我正在使用maven来构建和编译一个spring项目,这里有一个关于“打开zip文件时出错”的错误。我附加的设置。这里的xml显示我配置了代理右边和poml .xml。

[SETTINGS.XML]

(SETTINGS.XML)

<proxy>
        <active>true</active>
        <protocol>http</protocol>
        <host>XXXX</host>
        <port>8080</port>
        <username>XXXX</username>
        <password>XXXXX</password>
        <nonProxyHosts>localhost</nonProxyHosts>
     </proxy>

[POM.XML]

(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>com.wrox</groupId>
  <artifactId>springfirst</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>springfirst</name>
  <url>http://maven.apache.org</url>
    <build>
        <sourceDirectory>src/main/java</sourceDirectory>
        <testSourceDirectory>src/test/java</testSourceDirectory>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
                <filtering>true</filtering>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <spring-version>2.0.6</spring-version>
        <junit-version>3.8.2</junit-version>
    </properties>

  <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>${spring-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>${spring-version}</version>
        </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit-version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

[ERROR MESSAGE]

(错误消息)

E:\DOCUMENTS\ETC\TUTORIALS\begspringcode_091809\src\chapter1\springfirst>mvn -X compile
Apache Maven 3.0.3 (r1075438; 2011-03-01 01:31:09+0800)
Maven home: C:\maven2.2.1\bin\..
Java version: 1.6.0_15, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_15\jre
Default locale: en_PH, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\maven2.2.1\bin\..\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\AMT\.m2\settings.xml
[DEBUG] Using local repository at C:\Users\AMT\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Users\AMT\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.wrox:springfirst:jar:1.0-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.wrox:springfirst:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 42, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.wrox:springfirst:jar:1.0-SNAPSHOT
[DEBUG] Tasks:   [compile]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building springfirst 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-pack
age, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.177s
[INFO] Finished at: Mon Oct 03 14:57:47 SGT 2011
[INFO] Final Memory: 1M/4M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to parse plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2.4.3 (C:\Users\AMT\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3\maven-resources-plugin-2.4.3.jar): error in opening zip file -> [Help 1]
org.apache.maven.plugin.PluginDescriptorParsingException: Failed to parse plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2.4.3 (C:\Users\AMT\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3\maven-resources-plugin-2.4.3.jar): error in opening zip file
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.extractPluginDescriptor(DefaultMavenPluginManager.java:212)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:147)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
        at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
        at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
        at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:139)
        at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:116)
        at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:129)
        at org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(BuilderCommon.java:92)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        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(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
        at java.util.jar.JarFile.<init>(JarFile.java:133)
        at java.util.jar.JarFile.<init>(JarFile.java:112)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.extractPluginDescriptor(DefaultMavenPluginManager.java:170)
        ... 25 more
[ERROR]
[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/PluginDescriptorParsingException
'cmd' is not recognized as an internal or external command,
operable program or batch file.
E:\DOCUMENTS\ETC\TUTORIALS\begspringcode_091809\src\chapter1\springfirst>

3 个解决方案

#1


57  

Delete C:\Users\AMT\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3\maven-resources-plugin-2.4.3.jar or better still C:\Users\AMT\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3\ folder and try again.

删除C:\Users\AMT\.m2\repository\org\apache\maven\plugins\ maven-resources-plugin \ 2.4.3 \ maven-resources-plugin-2.4.3。jar或更好的是C:\Users\AMT\.m2\repository\org\apache\maven\plugins\ maven-resources-plugin \ 2.4.3 \文件夹并再试一次。

Evidently, the jar file is incomplete or corrupted.

显然,jar文件不完整或已被损坏。

#2


1  

Deleting the repository folder solved the issue.

删除存储库文件夹解决了这个问题。

#3


0  

Got the same issue. This worked for me.

有同样的问题。这为我工作。

Check your maven version

检查您的maven版本

HOME>> mvn -version
3.0.3

I updated this to maven 3.2.1 and change the path in bash_profile. Now check it again.

我将其更新为maven 3.2.1并更改bash_profile中的路径。现在检查一遍。

HOME>> mvn -version

If it is updated, delete the repository and close the terminal. Reopen the terminal and type

如果它被更新,删除存储库并关闭终端。重新打开终端并键入

Project Path >> mvn clean install 

If it not updated, then type following

如果没有更新,则输入follow

HOME>> echo $JAVA_HOME
HOME>> which java
/usr/share/java(for e.g.)
HOME>> cd /usr/share/java
HOME>> open .

You will see maven old version contents in it. Replace the contents of this with new version contents.

您将在其中看到maven旧版本内容。将其内容替换为新版本内容。

Then delete the repository.

然后删除存储库。

Project Path>> mvn clean install

Now all your maven jars will be downloaded.

现在所有的maven jar都将被下载。

Hope this will help you.

希望这对你有帮助。

#1


57  

Delete C:\Users\AMT\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3\maven-resources-plugin-2.4.3.jar or better still C:\Users\AMT\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.4.3\ folder and try again.

删除C:\Users\AMT\.m2\repository\org\apache\maven\plugins\ maven-resources-plugin \ 2.4.3 \ maven-resources-plugin-2.4.3。jar或更好的是C:\Users\AMT\.m2\repository\org\apache\maven\plugins\ maven-resources-plugin \ 2.4.3 \文件夹并再试一次。

Evidently, the jar file is incomplete or corrupted.

显然,jar文件不完整或已被损坏。

#2


1  

Deleting the repository folder solved the issue.

删除存储库文件夹解决了这个问题。

#3


0  

Got the same issue. This worked for me.

有同样的问题。这为我工作。

Check your maven version

检查您的maven版本

HOME>> mvn -version
3.0.3

I updated this to maven 3.2.1 and change the path in bash_profile. Now check it again.

我将其更新为maven 3.2.1并更改bash_profile中的路径。现在检查一遍。

HOME>> mvn -version

If it is updated, delete the repository and close the terminal. Reopen the terminal and type

如果它被更新,删除存储库并关闭终端。重新打开终端并键入

Project Path >> mvn clean install 

If it not updated, then type following

如果没有更新,则输入follow

HOME>> echo $JAVA_HOME
HOME>> which java
/usr/share/java(for e.g.)
HOME>> cd /usr/share/java
HOME>> open .

You will see maven old version contents in it. Replace the contents of this with new version contents.

您将在其中看到maven旧版本内容。将其内容替换为新版本内容。

Then delete the repository.

然后删除存储库。

Project Path>> mvn clean install

Now all your maven jars will be downloaded.

现在所有的maven jar都将被下载。

Hope this will help you.

希望这对你有帮助。