Maven WAR Plugin
  1. Maven WAR Plugin
  2. MWAR-248

Plugin warns about missing webxml attribute even if one exists

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None

      Description

      I am attaching a debug log that clearly demonstrates how the WAR plugin warns about a missing webxml attribute which exists. I am attempting to let the plugin know that the web.xml file it is encountering is the same one specified by the webxml attribute.

      My pom file contains:

      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <version>2.1.1</version>
      <configuration>
      <failOnMissingWebXml>true</failOnMissingWebXml>
      <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
      </configuration>
      </plugin>

        Issue Links

          Activity

          Hide
          Gili added a comment -

          It is worth noting that version 2.1 does not issue this warning message. This problem only occurs in version 2.1.1 and newer.

          Show
          Gili added a comment - It is worth noting that version 2.1 does not issue this warning message. This problem only occurs in version 2.1.1 and newer.
          Hide
          Gian Marco Gherardi added a comment -

          Same problem here, this problem start happening during upgrade from Maven 3.0 to Maven 3.0.2, that upgrade maven-war-plugin from 2.1 to 2.1.1

          Show
          Gian Marco Gherardi added a comment - Same problem here, this problem start happening during upgrade from Maven 3.0 to Maven 3.0.2, that upgrade maven-war-plugin from 2.1 to 2.1.1
          Hide
          Michael Glauche added a comment - - edited

          something like this is needed in the WarArchiver (needs some cleanup):

          Bar.java
          Index: src/main/java/org/codehaus/plexus/archiver/war/WarArchiver.java
          ===================================================================
          --- src/main/java/org/codehaus/plexus/archiver/war/WarArchiver.java	(revision 8799)
          +++ src/main/java/org/codehaus/plexus/archiver/war/WarArchiver.java	(working copy)
          @@ -167,10 +167,13 @@
                            && ( deploymentDescriptor == null
                                || !ResourceUtils.isCanonicalizedSame( entry.getResource(), deploymentDescriptor ) ) ) )
                       {
          -                getLogger().warn( "Warning: selected " + archiveType
          +            	if ( deploymentDescriptor == null
          +                     || !ResourceUtils.isCanonicalizedSame( entry.getResource(), deploymentDescriptor  ) ) {
          +            		getLogger().warn( "Warning: selected " + archiveType
                                             + " files include a WEB-INF/web.xml which will be ignored "
                                             + "\n(webxml attribute is missing from "
                                             + archiveType + " task, or ignoreWebxml attribute is specified as 'true')" );
          +            	}
                       }
                       else
                       {
          
          
          Show
          Michael Glauche added a comment - - edited something like this is needed in the WarArchiver (needs some cleanup): Bar.java Index: src/main/java/org/codehaus/plexus/archiver/war/WarArchiver.java =================================================================== --- src/main/java/org/codehaus/plexus/archiver/war/WarArchiver.java (revision 8799) +++ src/main/java/org/codehaus/plexus/archiver/war/WarArchiver.java (working copy) @@ -167,10 +167,13 @@ && ( deploymentDescriptor == null || !ResourceUtils.isCanonicalizedSame( entry.getResource(), deploymentDescriptor ) ) ) ) { - getLogger().warn( "Warning: selected " + archiveType + if ( deploymentDescriptor == null + || !ResourceUtils.isCanonicalizedSame( entry.getResource(), deploymentDescriptor ) ) { + getLogger().warn( "Warning: selected " + archiveType + " files include a WEB-INF/web.xml which will be ignored " + "\n(webxml attribute is missing from " + archiveType + " task, or ignoreWebxml attribute is specified as ' true ')" ); + } } else {
          Hide
          Anders Hammar added a comment - - edited

          It's also confusing the way the attributes are mentioned. Seeing this warning I thought it was talking about war plugin params.

          Also, to add on this, the statement of the included web.xml being ignored is invalid. In my project the web.xml is used.

          Show
          Anders Hammar added a comment - - edited It's also confusing the way the attributes are mentioned. Seeing this warning I thought it was talking about war plugin params. Also, to add on this, the statement of the included web.xml being ignored is invalid. In my project the web.xml is used.
          Hide
          Anders Hammar added a comment - - edited

          I can only reproduce this issue on Windows, not on Mac OS or Linux.

          However, on Max OS and Linux I get this instead:

          [INFO] WEB-INF/web.xml already added, skipping

          Show
          Anders Hammar added a comment - - edited I can only reproduce this issue on Windows, not on Mac OS or Linux. However, on Max OS and Linux I get this instead: [INFO] WEB-INF/web.xml already added, skipping
          Hide
          Alex Pogrebnyak added a comment - - edited

          Adding web.xml to webSourceExcludes and specifying webXml explicitly still results in the same warning

          pom.xml
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
              <warSourceExcludes>**/WEB-INF/web.xml</warSourceExcludes>
              <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
            </configuration>
          </plugin>
          
          Show
          Alex Pogrebnyak added a comment - - edited Adding web.xml to webSourceExcludes and specifying webXml explicitly still results in the same warning pom.xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <warSourceExcludes>**/WEB-INF/web.xml</warSourceExcludes> <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml> </configuration> </plugin>
          Hide
          Dennis Lundberg added a comment -

          Fixed by upgrading plexus-archiver to version 2.0.2.

          Show
          Dennis Lundberg added a comment - Fixed by upgrading plexus-archiver to version 2.0.2.
          Hide
          Kristian Rosenvold added a comment -

          We'll have to go to plexus-archiver 2.1 for this one before releasing. 2.0.2 contains a file-mode bug that hits linux systems when unzipping archives with unspecified file permissions. I can push war-release together with archiver "tomorrow".

          Show
          Kristian Rosenvold added a comment - We'll have to go to plexus-archiver 2.1 for this one before releasing. 2.0.2 contains a file-mode bug that hits linux systems when unzipping archives with unspecified file permissions. I can push war-release together with archiver "tomorrow".
          Hide
          poxd added a comment - - edited

          Starting with an empty war project containing only the web.xml file I still get the warning.

           
          > mvn --version
          Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
          Maven home: C:\utils\apache-maven\bin\..
          Java version: 1.6.0_20, vendor: Sun Microsystems Inc.
          Java home: C:\Program Files (x86)\Java\jdk1.6.0_20\jre
          Default locale: en_US, platform encoding: Cp1252
          OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
          
           
          > more pom.xml
          <?xml version="1.0" encoding="UTF-8" ?>
          <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/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <groupId>test</groupId>
            <artifactId>maven-war-warning</artifactId>
            <packaging>war</packaging>
            <version>1.0</version>
          </project>
          
           
          > mvn package
          ...
          [WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ig
          nored
          (webxml attribute is missing from war task, or ignoreWebxml attribute is specifi
          ed as 'true')
          

          To get rid of the warning I had to modify the pom to include this unintuitive addition:

           
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
            </configuration>
          </plugin>
          
          Show
          poxd added a comment - - edited Starting with an empty war project containing only the web.xml file I still get the warning. > mvn --version Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100) Maven home: C:\utils\apache-maven\bin\.. Java version: 1.6.0_20, vendor: Sun Microsystems Inc. Java home: C:\Program Files (x86)\Java\jdk1.6.0_20\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7" , version: "6.1" , arch: "x86" , family: "windows" > more pom.xml <?xml version= "1.0" encoding= "UTF-8" ?> <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>test</groupId> <artifactId>maven-war-warning</artifactId> <packaging>war</packaging> <version>1.0</version> </project> > mvn package ... [WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ig nored (webxml attribute is missing from war task, or ignoreWebxml attribute is specifi ed as ' true ') To get rid of the warning I had to modify the pom to include this unintuitive addition: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <packagingExcludes>WEB-INF/web.xml</packagingExcludes> </configuration> </plugin>
          Hide
          Anders Hammar added a comment -

          @Valentin: You most likely need to specify the version of the war plugin. I don't think Maven 3.0.4 uses v2.2 by default. Please continue this usage thread on the Maven users list.

          Show
          Anders Hammar added a comment - @Valentin: You most likely need to specify the version of the war plugin. I don't think Maven 3.0.4 uses v2.2 by default. Please continue this usage thread on the Maven users list.

            People

            • Assignee:
              Dennis Lundberg
              Reporter:
              Gili
            • Votes:
              25 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development