You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Maven User <ma...@gmail.com> on 2012/04/13 18:57:28 UTC

Simple filtering question

Hi all -

I'm struggling a bit with what seems like a really simple/silly thing.

I have to use an explicit configuration of the maven-resources-plugin to
copy and filter some resources.

What I'm seeing, regardless of packaging type, is if you explicitly
configure this plugin, it won't expand ANY properties within the file.

For grins, I took the same file I wanted to filter, put it in
src/main/resources, added a <resources> stanza and boom - everything is
properly filtered.

Here is the explicit plugin configuration I'm using - anything stand out?

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>default-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>.</outputDirectory>
                            <overwrite>true</overwrite>
                            <resources>
                                <resource>
                                    <filtering>true</filtering>
                                    <includes>
                                        <include>foo.txt</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

I tried several phases with no luck, so it's not that either.  In the
ultimate configuration, this will go into an aggregate pom with packaging
of "pom" - so this is why I need to explicitly configure this plugin.

Suggestions?

Re: Simple filtering question

Posted by Wayne Fay <wa...@gmail.com>.
>> What I'm seeing, regardless of packaging type, is if you explicitly
>> configure this plugin, it won't expand ANY properties within the file.

I doubt this is what is going on. Lots of people use filters with
various configurations applied.

>> For grins, I took the same file I wanted to filter, put it in
>> src/main/resources, added a <resources> stanza and boom - everything is
>> properly filtered.

This just tells me that your original configuration did not properly
define the resource you were wanting to filter, so Maven could not
find it, so it did not filter it.

Did you try <include>**/foo.txt</include>? Tell us what else you did try so far.

Wayne

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


Re: Simple filtering question

Posted by Maven User <ma...@gmail.com>.
Doesn't seem that different, but this does work.

Can't use includes?

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>blah-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>.</outputDirectory>
                            <overwrite>true</overwrite>
                            <resources>
                                <resource>

<directory>src/main/resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

On Fri, Apr 13, 2012 at 12:57 PM, Maven User <ma...@gmail.com> wrote:

> Hi all -
>
> I'm struggling a bit with what seems like a really simple/silly thing.
>
> I have to use an explicit configuration of the maven-resources-plugin to
> copy and filter some resources.
>
> What I'm seeing, regardless of packaging type, is if you explicitly
> configure this plugin, it won't expand ANY properties within the file.
>
> For grins, I took the same file I wanted to filter, put it in
> src/main/resources, added a <resources> stanza and boom - everything is
> properly filtered.
>
> Here is the explicit plugin configuration I'm using - anything stand out?
>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-resources-plugin</artifactId>
>                 <version>2.5</version>
>                 <executions>
>                     <execution>
>                         <id>default-resources</id>
>                         <phase>validate</phase>
>                         <goals>
>                             <goal>resources</goal>
>                         </goals>
>                         <configuration>
>                             <outputDirectory>.</outputDirectory>
>                             <overwrite>true</overwrite>
>                             <resources>
>                                 <resource>
>                                     <filtering>true</filtering>
>                                     <includes>
>                                         <include>foo.txt</include>
>                                     </includes>
>                                 </resource>
>                             </resources>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>
> I tried several phases with no luck, so it's not that either.  In the
> ultimate configuration, this will go into an aggregate pom with packaging
> of "pom" - so this is why I need to explicitly configure this plugin.
>
> Suggestions?
>
>