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>

猜你喜欢

转载自blog.csdn.net/m0_38019995/article/details/80760002