简体   繁体   English

无法读取工件 org.apache.maven.plugins:maven-install-plugin:maven-plugin:2.4:runtime 的生命周期映射元数据

[英]Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:maven-install-plugin:maven-plugin:2.4:runtime

Earlier today i was just doing some work on a maven project i just imported in and i was having some trouble with it.今天早些时候,我刚刚在我刚刚导入的 Maven 项目上做一些工作,但我遇到了一些问题。 It wasn't getting a certain dependency.它没有得到某种依赖。

Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:maven-install-plugin:maven-plugin:2.4:runtime无法读取工件 org.apache.maven.plugins:maven-install-plugin:maven-plugin:2.4:runtime 的生命周期映射元数据

Cause: invalid END header (bad central directory offset) pom.xml /SpringFileUpload line 1 Maven Project Build Lifecycle Mapping Problem原因:无效的 END 标头(bad central directory offset)pom.xml /SpringFileUpload line 1 Maven Project Build Lifecycle Mapping Problem

Here's my pom.xml:这是我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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.journaldev.spring</groupId>
    <artifactId>SpringFileUpload</artifactId>
    <name>SpringFileUpload</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <java-version>1.6</java-version>
        <org.springframework-version>4.0.0.RELEASE</org.springframework-version>
        <org.aspectj-version>1.7.4</org.aspectj-version>
        <org.slf4j-version>1.7.5</org.slf4j-version>
    </properties>
    <dependencies>
    <!-- Apache Commons FileUpload --> 
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.3.1</version>
    </dependency>

    <!-- Apache Commons IO --> 
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                 </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>   

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <!-- @Inject -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>        
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I tried to give the scope to servlet-api-jar and jsp-api-jar.我试图将范围赋予 servlet-api-jar 和 jsp-api-jar。 But it showing same error.但它显示同样的错误。 In my console following error getting:在我的控制台中出现以下错误:

Nov 02, 2016 3:43:17 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\User pc\Downloads\apache-tomcat-7.0.34\wtpwebapps\SpringFileUpload\WEB-INF\lib\jsp-api-2.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class
Nov 02, 2016 3:43:17 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\User pc\Downloads\apache-tomcat-7.0.34\wtpwebapps\SpringFileUpload\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

How to solve this?如何解决这个问题?

Check this link: Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:mav检查此链接: 无法读取工件 org.apache.maven.plugins:mav 的生命周期映射元数据

I got the same problem and resolved it with the proposed solution above.我遇到了同样的问题并使用上面建议的解决方案解决了它。 Change your pom.xml file into:将您的pom.xml文件更改为:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
</plugins>

first delete all the files present in ".m2/repository" folder.首先删除“.m2/repository”文件夹中存在的所有文件。 Then come to eclipse and update the project it will resolve the dependency.然后来eclipse并更新项目它将解决依赖关系。 worked for me 100%.为我工作 100%。

不要删除整个 .m2/repository 而是删除 .m2\\repository\\org\\apache\\maven\\plugins 文件夹然后更新项目。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 插件 org.apache.maven.plugins:maven-install-plugin:2.4 或其依赖项之一无法解析 - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved 无法读取工件org.apache.maven.plugins的生命周期映射元数据 - cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins mvn安装本地jar错误:无法执行目标org.apache.maven.plugins:maven-install-plugin…(是目录)-&gt; [帮助1] - Error with mvn install local jar: Failed to execute goal org.apache.maven.plugins:maven-install-plugin…(Is a directory) -> [Help 1] 无法读取org.apache.maven.plugins:maven-resources-plugin:jar:3.0.5的工件描述符 - Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:3.0.5 生命周期配置未涵盖插件执行:org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain 无法执行目标 org.apache.maven.plugins:maven-archetype-plugin:2.4:generate - Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate 找不到工件 org.apache.maven.plugins:maven-resources-plugin - Could not find artifact org.apache.maven.plugins:maven-resources-plugin 无法执行目标org.apache.maven.plugins:maven-jar-plugin:2.4:jar - Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar Maven:无法检索pluginorg.apache.maven.plugins:maven-install-plugin:2.4或无法解决其依赖项之一 - Maven: Failed to retrieve pluginorg.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1 - org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM