Maven異常

1.Maven項目的pom.xml文件表頭出現異常:org.apache.maven.plugins:maven-resources-plugin:2.4.3解決方案apache

出錯的位置:網絡

<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">eclipse

緣由:maven

這是因爲缺乏maven-resources-plugin-2.4.3.jar文件。在eclipse中配置的倉庫中缺乏這個文件:spa

解決方案:插件

(1)在pom.xml文件中加入maven-resources-plugin配置:component

<dependency>    
          <groupId>org.apache.maven.plugins</groupId>    
          <artifactId>maven-resources-plugin</artifactId>    
          <version>2.4.3</version>
 </dependency>
xml

(2)項目右鍵執行Maven install,這樣會在配置的默認使用的本地倉庫中添加maven-resources-plugin-2.4.3.jar文件blog

(3)右鍵項目進行刷新ip

(4)右鍵項目,選擇Maven4MyEclipse,選擇Update Project Configuration

2.Failure to transfer org.apache.maven.plugins:maven-war-plugin:jar:2.1.1?

出現這種現象多是由於網絡的緣由jar包沒有下載成,只須要找到本地maven倉庫中的對應包的文件夾,而後查看裏面是否有含有lastupdate字樣的文件,刪除掉。選中項目,右鍵Update Project Configuration,從新下載須要的jar

3.Maven-war項目中缺乏Maven Dependencies文件夾?

缺乏這個文件夾就是確認Jar包,這是很嚴重的問題,解決思路有兩個

第一個解決思路:

找到項目所在目錄

(1)修改.classpath文件

若是沒有m2e相關插件的配置,則添加:

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
</classpathentry>

(2)修改.project文件

若是<natures>中沒有m2e的配置,則添加:<nature>org.eclipse.m2e.core.maven2Nature</nature>

(3)項目進行Update Maven

(4)eclipse關機重啓

第二個解決思路:

是因爲項目的pom.xml中的dependencies標籤外面有一個dependencyManagement標籤,因此能夠把dependencyManagement標籤去掉,而後更新項目:右鍵-->Maven4MyEclipse--->Update project configuration

4.maven出現倉庫中找不到jar包的異常

有的時候jar包在遠程倉庫中,可是有的jar包根本不在倉庫中,這個時候能夠作一個假的jar包。

相關文章
相關標籤/搜索