问题
Earlier today i was just doing some work on a maven project i just imported in and i was having some trouble with it. It wasn't getting a certain dependency. I tried deleting the dependency folder then re downloading it and cleaning the project then updating it but it done nothing. Then i noticed that my other maven project popped up with an error with the pom.xml that the first one had as well. "Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:mav" I updated maven to 3.1.0 still nothing. Here's my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.kyle.burnett</groupId>
<artifactId>Sky-Block-Wars</artifactId>
<version>1.0.0</version>
<name>Sky-Block Wars</name>
<url>http://dev.bukkit.org/bukkit-plugins/sky-block-wars/</url>
<description>Shrunk
</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.6.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>5.5.8-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.6.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public</url>
</repository>
<repository>
<id>sk89w repo</id>
<url>http://maven.sk89q.com/repo</url>
<!-- <url>http://maven.sk89q.com/artifactory/libs-release-local</url> -->
</repository>
</repositories>
<build>
<sourceDirectory>src/</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
回答1:
I had the same error. I removed the directory containing the different versions of the maven-war-plugin from my local repository. After this I startet the build with mvn install -U to update all the plugins.
The plugin was downloaded again and the error was gone.
回答2:
When I add below tags in pom.xml , the problem has been resolved.
<build>
<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>
</build>
回答3:
Step 1) Please download the jar files Manually (Outside of Maven ) and place it in C:\Users\.m2\repository\org\apache\maven\plugins.
Step 2) Delete the project from Eclipse and import it as maven project.
This issue will happen because some of the Maven plugin jar files not being downloaded properly . example : If pox.xml file showing the error "Cannot read lifecycle mapping metadata for artifact org.apache.maven.plugins:maven-site-plugin:maven-plugin:3.0-beta-3:runtime Cause: error in opening zip file" then manually download the maven-site-plugin.jar (download the right version that ur project is expecting) and place it in C:\Users\.m2\repository\org\apache\maven\plugins.
Ananth k
回答4:
I don't want to resurrect this topic, but I had the same error. When I make a Maven project on Eclipse/Windows and when I import this same project on Eclipse/OSX.
To fix it : right click on your project -> Maven -> Update Project
I have this issue on all my projects and this fix them always
回答5:
In Ubuntu to solve this I use this command on Terminal:
sudo rm -rf ~/.m2/repository
回答6:
Please download the jar files Manually (Outside of Maven ) and place it in C:\Users.m2\repository\org\apache\maven\plugins.
回答7:
Check if you have set path variables for MAVEN_HOME and JAVA_HOME correctly. Then Delete the folder ${HOME}/.m2/repository/org/apache/maven/plugins/maven-site-plugin and then update the project. For more details. go to https://www.eclipse.org/lists/m2e-users/msg04952.html
Above worked for me. Hope this helps.
来源:https://stackoverflow.com/questions/17815639/cannot-read-lifecycle-mapping-metadata-for-artifact-org-apache-maven-pluginsmav