Spring – Dynamic Web Module 3.0 — 3.1

eclipsemavenspringspring-mvc

I have a mavenized codebased configured Spring 3.2.4 web app.
When I build the app with Maven/pom.xml first I got an error that web.xml is missing.
first I tried to create an empty web.xml. this was the moment when The project facets changed (and I don't know why). It switched from dynamic Web Module 3.0 to 3.1 and this is irreversible.
How can I change it again into Dynamic Web Modules 3.0???

enter image description here

Additionally I can't remove the JAX-RS. Trying this it results in:

Failed while uninstalling JAX-RS (REST Web Services) 1.0.
org.eclipse.jst.javaee.web.internal.impl.WebAppImpl cannot be cast to org.eclipse.jst.j2ee.webapplication.WebApp

Later I found out that I can avoid the Maven compile error by inserting the according plugin into pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
</plugin>

Best Answer

I had similar troubles in eclipse and the only way to fix it for me was to

  • Remove the web module
  • Apply
  • Change the module version
  • Add the module
  • Configure (Further configuration available link at the bottom of the dialog)
  • Apply

Just make sure you configure the web module before applying it as by default it will look for your web files in /WebContent/ and this is not what Maven project structure should be.

EDIT:

Here is a second way in case nothing else helps

  • Exit eclipse, go to your project in the file system, then to .settings folder.
  • Open the org.eclipse.wst.common.project.facet.core.xml , make backup, and remove the web module entry.
  • You can also modify the web module version there, but again, no guarantees.
Related Topic