1. 程式人生 > >一個maven錯誤:org/apache/maven/shared/filtering/MavenFilteringException

一個maven錯誤:org/apache/maven/shared/filtering/MavenFilteringException

電腦重啟後不知道為啥eclipse中的maven不能用了,pom檔案一直標紅,報以下錯誤:

Execution default-cli of goal org.apache.maven.plugins:maven-resources-plugin:2.5:copy-resources failed: A required class was missing while executing org.apache.maven.plugins:maven-resources-plugin:2.5:copy-resources: org/apache/maven/shared/filtering/MavenFilteringException

-----------------------------------------------------
realm =    plugin>org.apache.maven.plugins:maven-resources-plugin:2.5
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/admin/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.jar
urls[1] = file:/C:/Users/admin/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
Number of foreign imports: 1

import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

但是在.m2下maven外掛:maven-resources-plugin的確是存在的,而且版本號的確是2.5大哭

解決辦法,在pom檔案中增加:

    <plugins>
        <plugin>  
   <groupId>org.apache.maven.plugins</groupId>  
   <artifactId>maven-resources-plugin</artifactId>  
   <version>2.4.3</version>  
   <configuration>  
       <encoding>utf-8</encoding>  
   </configuration>  
</plugin> 
    </plugins>

具體原因以後再查。