Example with filtering.

In resource settings I define target path as well, as I need to filter not 
only src/main/resources but src/main/webapp directories as well.



<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>lt.sintagma.projects</groupId>
  <artifactId>web-project-skaitis</artifactId>
  <packaging>war</packaging>
  <version>3.0</version>
  <name>SKAITIS CIA Web site project</name>
  <url>http://www.sintagma.lt</url>
  <build>
    <!-- When packaging war file, both "/src/main/resources" and 
"/src/main/webapp"
          should pass through a resource filter to replace @property@ 
properties with a value from a filter file 
     -->
    <resources>
      <resource>
        <targetPath>../filtered-webapp-resources</targetPath>
        <filtering>true</filtering>
        <directory>${basedir}/src/main/webapp</directory>
      </resource>
      <resource>
 <targetPath>../filtered-webapp-resources/WEB-INF/classes</targetPath>
        <filtering>true</filtering>
        <directory>${basedir}/src/main/resources</directory>
      </resource>
    </resources>
   <plugins>

     <!-- Resources plugin configuration to enable filtering. 
          Files will be copied from <directory> to <targetPath> 
directories 
          as defined in project.build.resources configuration 
          This also requires War plugin configuration modification
      -->
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-resources-plugin</artifactId>
       <executions>
         <execution>
           <goals>
             <goal>resources</goal>
           </goals>
           <configuration>
 
<filterPropertiesFile>${basedir}/src/filters/${filterFile}</filterPropertiesFile>
             <filtering>true</filtering>
           </configuration>
          </execution>
        </executions>
      </plugin>

...

Andrius




Sena Gbeckor-Kove <[EMAIL PROTECTED]> 
2005.09.30 15:52
Please respond to
"Maven Users List" <[email protected]>


To
Maven Users List <[email protected]>, Brett Porter 
<[EMAIL PROTECTED]>
cc

Subject
Re: [m2] Filtering problems in Beta






Hi,

I was wondering if anybody could give mea fragment of their pom where
they are using filtering. I am migratnig a large project at the EPO
and I can't find any ocumentation on it. I am using beta 2.

Thx



On 24/09/05, Brett Porter <[EMAIL PROTECTED]> wrote:
> FYI - In beta-2, while the other technique is still supported, the
> recommended way is finally settled:
>
> <build>
>   <filters>
>     <filtersFile>...</filtersFile>
>   </filters>
> </build>
>
> (also available in profiles).
>
> Sorry it missed beta-1, but we will be retaining the other option for
> backwards compatibility.
>
> - Brett
>
> On 9/24/05, Tony Steele <[EMAIL PROTECTED]> wrote:
> > Thanks
> >
> > That worked, I left out the target path as I wanted it to go to the
> > default location.
> >
> > Tony
> >
> > -----Original Message-----
> > From: Andrius Karpavicius [mailto:[EMAIL PROTECTED]
> > Sent: 23 September 2005 13:09
> > To: Maven Users List
> > Subject: Re: [m2] Filtering problems in Beta
> >
> >
> > Hi,
> >
> > Add <filtering>true</filtering> parameter in resources descriptor
> >
> >   <build>
> >     <resources>
> >       <resource>
> >         <targetPath>../filtered-webapp-resources</targetPath>
> >         <filtering>true</filtering>
> >         <directory>${basedir}/src/main/webapp</directory>
> >       </resource>
> >
> >     </resources>
> >
> > Andrius
> >
> >
> >
> >
> > "Tony Steele" <[EMAIL PROTECTED]>
> > 2005.09.23 13:01
> > Please respond to
> > "Maven Users List" <[email protected]>
> >
> >
> > To
> > <[email protected]>
> > cc
> >
> > Subject
> > [m2] Filtering problems in Beta
> >
> >
> >
> >
> >
> >
> > When I upgraded to the beta version, the filtering of resources
> > specified in my pom stopped working.
> > I found this on jira http://jira.codehaus.org/browse/MNG-788  which
> > indicated that there had been improvements to resource filtering.
> >
> > My filtering uses profiles and is set up as follows:
> >
> >                  <build>
> >                                  <plugins>
> >                                                  <plugin>
> >
> > <groupId>org.apache.maven.plugins</groupId>
> >
> > <artifactId>maven-resources-plugin</artifactId>
> >  <configuration>
> >   <filtering>true</filtering>
> >
> > <filterPropertiesFile>${resource.filter.file}</filterPropertiesFile>
> >  </configuration>
> >                                                  </plugin>
> >                                  </plugins>
> >                  </build>
> >
> >                  <profiles>
> >                                  <profile>
> >                                    <id>live</id>
> >                                    <properties>
> >
> > 
<resource.filter.file>${basedir}/conf/${project.artifactId}-live.propert
> > ies</resource.filter.file>
> >                                    </properties>
> >                                  </profile>
> >                                  <profile>
> >                                    <id>pcdev</id>
> >                                    <properties>
> >
> > 
<resource.filter.file>${basedir}/conf/${project.artifactId}-pcdev.proper
> > ties</resource.filter.file>
> >                                    </properties>
> >                                  </profile>
> >                                  <profile>
> >                                    <id>uat</id>
> >                                    <properties>
> >
> > 
<resource.filter.file>${basedir}/conf/${project.artifactId}-uat.properti
> > es</resource.filter.file>
> >                                    </properties>
> >                                  </profile>
> >                  </profiles>
> >
> > I have tried removing the profiles, and specified the
> > filterPropertiesFile directly, but is still does not work.
> >
> > Any idea what changes could have stopped the above working. Tony 
Steele
> >
> >
> > http://www.bbc.co.uk/
> >
> > This e-mail (and any attachments) is confidential and may contain
> > personal views which are not the views of the BBC unless specifically
> > stated. If you have received it in error, please delete it from your
> > system.
> > Do not use, copy or disclose the information in any way nor act in
> > reliance on it and notify the sender immediately. Please note that the
> > BBC monitors e-mails sent or received.
> > Further communication will signify your consent to this.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > http://www.bbc.co.uk/
> >
> > This e-mail (and any attachments) is confidential and may contain
> > personal views which are not the views of the BBC unless specifically
> > stated.
> > If you have received it in error, please delete it from your system.
> > Do not use, copy or disclose the information in any way nor act in
> > reliance on it and notify the sender immediately. Please note that the
> > BBC monitors e-mails sent or received.
> > Further communication will signify your consent to this.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to