maven项目常见问题
问题1:Maven项目,右键-update project后报错如下的解决办法:
1)、DescriptionResourcePathLocationType
Java compiler level does not match the version of the installed Java project facet.SSMDemo Maven WebUnknownFaceted Project Problem (Java Version Mismatch)
2)、DescriptionResourcePathLocationType
JAX-RS (REST Web Services) 2.0 requires Java 1.7 or newer.SSMDemo Maven Webline 1Maven Java EE Configuration Problem
3)、DescriptionResourcePathLocationType
One or more constraints have not been satisfied.SSMDemo Maven Webline 1Maven Java EE Configuration Problem
4). Type One or more constraints have not been satisfied.
解决办法:在pom.xml配置文件中加入如下语句:
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7(JDK的版本)</source> <target>1.7(JDK的版本)</target> </configuration> </plugin> </plugins>
或者
<profiles> <profile> <id>jdk-1.8</id> <!-- 另外一种激活方式 --> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> </profile> </profiles>
然后再update project就好了,jdk版本问题。
问题2:
1). The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path index.jsp /user_cms/src/main/webapp
2). javax.servlet.jsp cannot be resolved to a type main.jsp /midware_web/src/main/webapp/WEB-INF/view/common/decorators line 14 JSP Problem
解决方法:
1).
2).选择项目->properties->project facets修改java版本和Dynamic web module
同时修改项目路径文件
工程路径\.settings\org.eclipse.wst.common.project.facet.core.xml
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
3).修改properties->java compiler中java版本
4).解决只显示resource文件