web.xml error is missing and failOnMissingWebXml is set to true

2

Generallythequestionis,haveyoudeployedtheproject?Theanswerisyes.

IclickedontheprojectIwasinMavenafterUpdateproject,itisprocedurethatIalwaysdomyprojectsandthisisgivingproblem.

web.xml

<projectxmlns="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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>br.com.comercial.adm</groupId>
    <artifactId>ComercialADM</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>



    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>




        <!-- PrimeFaces (biblioteca de componentes) -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>3.5</version>
            <scope>compile</scope>
        </dependency>

        <!-- Mojarra (implementacao do JSF) -->
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.faces</artifactId>
            <version>2.1.21</version>
            <scope>compile</scope>
        </dependency>




    </dependencies>



    <build>
        <finalName>ComercialADM</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>prime-repo</id>
            <name>PrimeFaces Maven Repository</name>
            <url>http://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
    </repositories>




</project>
    
asked by anonymous 08.12.2015 / 20:16

1 answer

7

The error occurs because as packaging was set to war, maven recognizes by default the configuration of the need for a web.xml, given the version of the servlet you are using, if it is earlier than version 3.0, the web .xml is required.

If the version is the current one, one way to eliminate this error is to set the failOnMissingWebXml to false in maven-war-plugin.

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

link

    
10.12.2015 / 02:16