Cannot change version Facet Dynamic Web Module to 4.0. Maven

Asked

Viewed 277 times

1

I had this problem and I thought I had solved it, but when I opened eclipse hj the problem just happened again, the strange thing is that it only occurs inside the IDE, because if I compile and put War in wildfly it runs smoothly.

The problem gets even stranger due to the fact that when I enter "project -> properties -> project facets" the "Dynamic Web Module" is set to 4.0

follows the project configuration file that has such information, called "org.eclipse.wst.common.project.facet.core.xml":

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.8"/>
  <installed facet="jst.web" version="4.0"/>
  <installed facet="jst.jsf" version="2.2"/>
  <installed facet="jst.jaxrs" version="2.0"/>
</faceted-project>

my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>br.com.lsoft</groupId>
  <artifactId>gamesapi</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>gamesapi Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>4.0.0</version>
        <scope>provided</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>2.3.1</version>
        <scope>provided</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.wildfly/wildfly-servlet-feature-pack -->
    <!-- https://mvnrepository.com/artifact/org.wildfly/wildfly-spec-api -->
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-spec-api</artifactId>
        <version>13.0.0.Final</version>
        <type>pom</type>
    </dependency>




  </dependencies>
  <build>
    <finalName>gamesapi</finalName>

    <plugins>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
        </plugin>

    </plugins>

  </build>
</project>

web xml.:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" 
    id="WebApp_ID" 
    version="4.0">


  <display-name>Archetype Created Web Application</display-name>


  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

I tried to download the eclipse again, thinking that maybe the version I had caught was in trouble, however it did not help

I have no idea what might be going on, can anyone tell me what could be causing this????

IDE: eclipse project: Maven(Maven-archetype-webapp)

follows the link of the post I created earlier:

https://cursos.alura.com.br/forum/topico-como-fazer-o-build-e-executar-pela-ide-79891

1 answer

1

Change in the file org.eclipse.wst.common.project.facet.core.xml to Facet jst.web to 3.0 or desired:

<installed facet="jst.web" version="3.0"/>

Also change your web.xml the Deployment Descriptor information (the attribute version and the schemaLocation) to reflect the desired version:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"      version="3.0">

You can find here(article in English) more Deployment Descriptors.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.