How to fix Cannot change version of project facet Dynamic Web Module to 3.0 Error in Eclipse---转载
How to fix Cannot change version of project facet Dynamic Web Module to 3.0 Error in Eclipse
原文:http://crunchify.com/how-to-fix-cannot-change-version-of-project-facet-dynamic-web-module-to-3-0-error-in-eclipse/
Today while converting Dynamic Web Project to Maven project I got below Error:
1
2
|
Cannot change version of project facet Dynamic Web Module to 3.0
One or more constraints have not been satisfied
|
What steps I’ve performed to fix this?
In order to fix this first thing I did is to change Project Facets settings.
Right click on Project
in Eclipse- Click on
Properties
- Click on
Project Facets
Tab - Change value from
3.1
to3.0
for Dynamic Web Module as mentioned in below image.
Did it work? Nope.
But unfortunately I was not able to apply setting as Apply and OK button was grayed out with error msg:Cannot change version of project facet Dynamic Web Module to 3.0
.
I was literally stuck at this point.
Then I’ve looked at my pom.xml
file. I’ve converted Dynamic Web Project to Maven Project by following steps in article.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
|
By default Eclipse adds above <build> block to pom.xml file and that is THE problem for this error: Cannot change version of project facet Dynamic Web Module to 3.0
.
How to fix?
Step-1
Just replace <build> block with this one.
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
|
Step-2
- Right Click on Project
- Click Maven
- Click Update Project
or
- use Quick Fix from error console