You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Billy Newman <ne...@gmail.com> on 2012/11/06 16:45:47 UTC

Filtering web.xml?

I am trying to filter my web.xml with no luck.

Current structure:
pom.xml
--> src
--->main
---->webapp
----->WEB-INF
------>web.xml

I have the war plugin defined as follows:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <webResources>
            <resource>
              <directory>${basedir}/src/main/webapp/WEB-INF</directory>
              <filtering>true</filtering>
              <includes>
                <include>*.xml</include>
              </includes>
            </resource>
          </webResources>
        </configuration>
      </plugin>

After I build I can look in the target directory and the web.xml that
lives in the exploded dir is correctly filtered.  However the web.xml
that gets packaged up in the war is not filtered.  So its like my
filtered web.xml got copied into target after the war was built.  I
imagine that I am not filtering the web.xml correctly, any ideas?

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Filtering web.xml?

Posted by Thomas Broyer <t....@gmail.com>.
On Tue, Nov 6, 2012 at 4:45 PM, Billy Newman <ne...@gmail.com> wrote:
> I am trying to filter my web.xml with no luck.
>
> Current structure:
> pom.xml
> --> src
> --->main
> ---->webapp
> ----->WEB-INF
> ------>web.xml
>
> I have the war plugin defined as follows:
>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-war-plugin</artifactId>
>         <version>2.3</version>
>         <configuration>
>           <webResources>
>             <resource>
>               <directory>${basedir}/src/main/webapp/WEB-INF</directory>
>               <filtering>true</filtering>
>               <includes>
>                 <include>*.xml</include>
>               </includes>
>             </resource>
>           </webResources>
>         </configuration>
>       </plugin>
>
> After I build I can look in the target directory and the web.xml that
> lives in the exploded dir is correctly filtered.  However the web.xml
> that gets packaged up in the war is not filtered.  So its like my
> filtered web.xml got copied into target after the war was built.  I
> imagine that I am not filtering the web.xml correctly, any ideas?

web.xml is a special file. You have to set
filteringDeploymentDescriptors to true to filter it (and no need to
mess up with <webResources> then)

http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#filteringDeploymentDescriptors

--
Thomas Broyer
/tɔ.ma.bʁwa.je/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Filtering web.xml?

Posted by Tomasz Pik <to...@gmail.com>.
On Tue, Nov 6, 2012 at 4:45 PM, Billy Newman <ne...@gmail.com> wrote:

> I am trying to filter my web.xml with no luck.
>
> Current structure:
> pom.xml
> --> src
> --->main
> ---->webapp
> ----->WEB-INF
> ------>web.xml
>
> I have the war plugin defined as follows:
>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-war-plugin</artifactId>
>         <version>2.3</version>
>         <configuration>
>           <webResources>
>             <resource>
>               <directory>${basedir}/src/main/webapp/WEB-INF</directory>
>               <filtering>true</filtering>
>               <includes>
>                 <include>*.xml</include>
>               </includes>
>             </resource>
>

Please, try to add second section of resources:

            <resource>
              <directory>${basedir}/src/main/webapp/WEB-INF</directory>
              <filtering>false</filtering>
              <excludes>
                <exclude>*.xml</exclude>
              </excludes>
            </resource>

Regards,
Tomek


>           </webResources>
>         </configuration>
>       </plugin>
>
> After I build I can look in the target directory and the web.xml that
> lives in the exploded dir is correctly filtered.  However the web.xml
> that gets packaged up in the war is not filtered.  So its like my
> filtered web.xml got copied into target after the war was built.  I
> imagine that I am not filtering the web.xml correctly, any ideas?
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>