项目环境:JDK 1.7 + maven 3.0.5
从别的地方引入的老版本的项目,引入后一直报 One or more constraints have not been satisfied 和 Cannot change version of project facet Dynamic Web Module to 2.5 两个错误,再网上找了不少方法,包括
1、修改.settings/org.eclipse.wst.common.component.xml 下的 project-version,
修改.settings/org.eclipse.wst.common.project.facet.core.xml 下的
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/> 这几个参数
2、在pom.xml里面添加
<profile> <id>jdk-1.7</id> <!-- 另外一种激活方式 --> <activation> <activeByDefault>true</activeByDefault> <jdk>1.7</jdk> </activation> <properties> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion> </properties>
</profile>
或者
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin>
都没成功,经过多方思考最终尝试将项目.settings目录下的文件全部删除,然后再进行maven update后,相关报错成功解决。