You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ian Rowlands <Ia...@sro.vic.gov.au> on 2007/05/28 06:31:47 UTC

Doing "multiple" filters




Just wondering what is the best way to do "multiple" filters over a set of
files.  The context of the question is:

I have a set of configuration files, and 6 different environments they
could be deployed in.  There is one properties file for each environment.
I'd like to generate the configuration files for all of the environments
during the build, stored in different sub-directories.  Then when I deploy,
I'll extract the set of files which is appropriate and deploy them.  But I
need to have the files for all environments upfront.

>From my understanding of maven filtering, I can only filter the files once.

Any ideas?


Regards,

Ian Rowlands



Disclaimer: The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or other use
of, or taking of any action in reliance upon, this information by persons
or entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the material
from your computer.
Privacy: If you are responding to this email or providing personal
information to the SRO for the purposes of one of the Acts it administers,
such information is used only for the purpose for which it was collected
( administration of SRO legislation ) and is protected by the Information
Privacy Act 2000 and secrecy provisions contained in legislation
administered by SRO. It is not disclosed otherwise than in accordance with
the law. If you would like a copy of the SRO Privacy Policy please refer to
SRO website (www.sro.vic.gov.au) or contact SRO on 9628 0556 and request a
copy.


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


Re: Doing "multiple" filters

Posted by Steven Rowe <sa...@syr.edu>.
Hi Ian,

[Warning: Following is untested.]

I don't know about the best way, but I think you should be able to set
up an <execution> for each of the filterings you want to do, something like:

<build>
  ...
  <plugins>
    ...
    <plugin>
      <artifactId>maven-resources-plugin</artifactId>
      <executions>
        <execution>
          <id>one</id>
          <goals><goal>resources</goal></goals>
          <configuration>
            <resources>
              <resource>
                ...  <!-- same syntax as <build><resources>? -->
              </resource>
            </resources>
            <filters>
              <filter>
                ...  <!-- same syntax as <build><filters>? -->
              </filter>
            </filters>
            <outputDirectory>
              ${project.build.outputDirectory}/one
            </outputDirectory>
          </configuration>
        </execution>
        <execution>
          <id>two</id>
          ...
        </execution>
        ...
      </executions>
    </plugin>
    ...
  </plugins>
</build>

Steve

Ian Rowlands wrote:
> Just wondering what is the best way to do "multiple" filters over a set of
> files.  The context of the question is:
> 
> I have a set of configuration files, and 6 different environments they
> could be deployed in.  There is one properties file for each environment.
> I'd like to generate the configuration files for all of the environments
> during the build, stored in different sub-directories.  Then when I deploy,
> I'll extract the set of files which is appropriate and deploy them.  But I
> need to have the files for all environments upfront.
> 
> From my understanding of maven filtering, I can only filter the files once.
> 
> Any ideas?


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