1. 程式人生 > >maven專案常見錯誤

maven專案常見錯誤

1、錯誤提示:

Error resolving version for plugin 'org.apache.maven.plugins:maven-compiler-plugin' from the repositories [local (E:\tools\maven-repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository

解決辦法如下:

pom.xml中在plugin裡面指定版本號即可(具體版本號是多少根據實際情況而定)

<version>2.3.2</version>

2、錯誤提示

cannot change version of project facet dynamic web module to 3.0

解決辦法如下:

     1、找到專案路徑.settings資料夾中的org.eclipse.jdt.core.prefs

         

       2、1.5改成1.8

       

       3、找到專案路徑.settings資料夾中的org.eclipse.wst.common.project.facet.core.xml

       

       4、java改為1.8,jst.web改為3.0

      

       5、更改web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="schedule-console" version="3.0">

       6、專案上右鍵重新整理

       7、就可以在project facets上正常配置了

            

3、java Resources資料夾有紅叉

 解決辦法:在pom.xml中新增如下配置

  <build>
    	<plugins>
   	        <plugin>
   		     <groupId>org.apache.maven.plugins</groupId>
   		     <artifactId>maven-compiler-plugin</artifactId>
   		     <configuration>
   		          <source>1.8</source>
   		          <target>1.8</target>
   		          <encoding>UTF-8</encoding>
   		     </configuration>
   		</plugin>
        </plugins>
  </build>