Uploaded image for project: 'Maven WAR Plugin'
  1. Maven WAR Plugin
  2. MWAR-200

Filtering resource don't work as expected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.1-alpha-1, 2.1-beta-1
    • None
    • filtering
    • None
    • windows and unix

    Description

      Hi,

      I try to use maven war plugin and cargo however I have a problem with maven-war-plugin and the filtering.
      I tried with 2.1-beta-1 and alpha1

      My configuration for the maven-war-plugin is the following :

      			<!-- pour tout les projets d'intégration, il faut ajouter un fichier context.xml qui sera filtré -->	
      	        <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-war-plugin</artifactId>
      			<version>2.1-beta-1</version>
                  <configuration>
                      <webResources>
                          <resource>
                              <directory>${basedir}/src/main/webapp/META-INF</directory>
                              <filtering>true</filtering>
                              <includes>
                                  <include>context.xml</include>
                              </includes>
                              <targetPath>META-INF/</targetPath>
                          </resource>
                      </webResources>
                  </configuration>
              </plugin>  
      

      My goal is to filter the context.xml to modify the name of the datasource

      My context.xml unfiltered is :

      <!-- Context configuration file for the Webintake services -->
      <Context path="/myWebapp" debug="0" privileged="true" reloadable="false">
      	<Resource auth="Container" name="jdbc/DATABASEHTTP" factory="org.apache.commons.dbcp.BasicDataSourceFactory"
      		type="javax.sql.DataSource" driverClassName="${connection.driver_class}"
      		url="${connection.url}" username="${connection.username}" password="${connection.password}" maxActive="50" maxIdle="2"
      		maxWait="10000" />
      </Context>
      

      I use mvn clean install to launch the build
      In DEBUG mode I have :

      [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-war-plugin:2.1-alpha-1:war' -->
      [DEBUG]   (f) addDefaultSpecificationEntries = true
      [DEBUG]   (f) addDefaultImplementationEntries = true
      [DEBUG]   (s) manifest = org.apache.maven.archiver.ManifestConfiguration@1d50fd2
      [DEBUG]   (f) archive = org.apache.maven.archiver.MavenArchiveConfiguration@101ac1c
      [DEBUG]   (s) archiveClasses = true
      [DEBUG]   (s) cacheFile = E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\target\war\work\webapp-cache.xml
      [DEBUG]   (s) classesDirectory = E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\target\classes
      [DEBUG]   (s) filters = []
      [DEBUG]   (f) outputDirectory = E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\target
      [DEBUG]   (f) primaryArtifact = true
      [DEBUG]   (s) project = MavenProject: fr.sgf.wit:webintake-security-integration:3.5.0-alpha3-SNAPSHOT @ E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\pom.xml
      [DEBUG]   (s) useCache = true
      [DEBUG]   (f) warName = webintake-security-integration-3.5.0-alpha3-SNAPSHOT
      [DEBUG]   (s) warSourceDirectory = E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\src\main\webapp
      [DEBUG]   (s) directory = E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration/src/main/webapp/META-INF
      [DEBUG]   (s) filtering = true
      [DEBUG]   (s) includes = [context.xml]
      [DEBUG]   (s) targetPath = META-INF/
      [DEBUG]   (s) webResources = [Resource {targetPath: META-INF/, filtering: true, FileSet {directory: E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration/src/main/webapp/META-INF, PatternSet [includes: {context.xml}, excludes: {}]}}]
      [DEBUG]   (s) webappDirectory = E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\target\webintake-security-integration-3.5.0-alpha3-SNAPSHOT
      [DEBUG]   (s) workDirectory = E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\target\war\work
      [DEBUG] -- end configuration --
      [INFO] [war:war]
      [INFO] Packaging webapp
      [INFO] Assembling webapp[webintake-security-integration] in [E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\target\webintake-security-integration-3.5.0-alpha3-SNAPSHOT]
      [INFO] Processing war project
      [INFO] Copy webapp webResources[E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration/src/main/webapp/META-INF] to[E:\Developpement\checkout\webintakeTrunk\webintake-security\webintake-security-integration\target\webintake-security-integration-3.5.0-alpha3-SNAPSHOT]
      [DEBUG]  + META-INF/\context.xml has been copied.
      [DEBUG]  + META-INF/context.xml has been copied.
      

      So the filtering is active and the context.xml is copied as expected but not filtered !
      The file is not modified, I still have the variable not filtered.

      If I make mvn install (removing the clean) it works the second time, I guess the file is read from the right place the second time ?

      I attached the mvn command with option -X

      Attachments

        1. toto.txt
          488 kB
          hugo lassiege

        Activity

          People

            Unassigned Unassigned
            hugo123 hugo lassiege
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: