You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thomas Sundberg <ts...@kth.se> on 2016/01/12 23:14:41 UTC

Filtering resources

Hi!

I need to be able to filter files where the values to replace are defind as

@aPlaceHolderThatNeedToBeSubstituted@

Does anyone know of a good, working example where a custom resource
filter is implemented?

I had a look at
http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
and it is a bit sketchy. A complete, annotated example would be nice
where all details needed to implement this interface
MavenResourcesFiltering are shared.

A Git repo to clone would be the most awesome tip I can think of.

Cheers,
Thomas

-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

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


Re: Filtering resources

Posted by Thomas Sundberg <ts...@kth.se>.
Hi!

On 14 January 2016 at 15:09, Stephen Connolly
<st...@gmail.com> wrote:
> and how do I differentiate @foo@bar@@ whether that would be equivalent to
> either:
>
>  ${foo}bar${}
>
> or
>
>  ${foo${bar}}
>

This is obviously a complicated example if you allow empty tokens when
using the same delimiter as start and end indicator.

I don't think empty tokes are reasonable. I can't come up with sample
code that would do any reasonable filtering with

@@

Specifying this token in a property file would look like this:

 = the actual value

So, to me empty tokens are an error or an indication of something else.

Empty tokens when using different delimiters such as ${} is possible
to detect since there are different start and end indicators. But the
question on what you should replace them with is still valid.

>
> if using ${ } style delimiters for the start and end?
>
> At least with ${ } style delimiters one can count braces...
>
> how about @foo@bar@manchu@ is that supposed to be ${foo${bar}manchu} or
> ${foo}bar${manchu}
>

I would go with the latter. Which is consistent with how filtering in
Maven is implemented today.

This limits the possibilities a bit on where you can place nested
tokens. Using the same delimiter, you would only be able to place them
at the beginning or end. That is relying two or more of them next to
each other.

Given this, then would the example

@foo@bar@@

be equal to

 ${foo${bar}}

And

@@foo@bar@

be equal to

${${foo}bar}

Using the same delimiter to indicate start and end of a token is
complicated and it would have been nice if it wasn't allowed. But it
is. And heavily used in the filtering case I need to resolve.

>
> Start trying to answer that question and you will see that the rules get
> very fast very quickly
>

I don't really see that it would be extremely complicated. Definitely
complicated using the same delimiter, but not impossible. Using
different delimiters for start and stop would make it easier.
Remembering Scheme, a lisp dialect, makes me wish for parentheses as
delimiters.

It actually surprises me that nested tokens isn't properly supported
in the case ${${foo}bar} or  ${foo${bar}}
But it isn't when I am testing with Maven 3.3.9 and maven-filtering 3.0.0.

Cheers,
Thomas





>
> On 14 January 2016 at 09:10, Thomas Sundberg <ts...@kth.se> wrote:
>
>> Hi!
>>
>> On 13 January 2016 at 19:01, Robert Scholte <rf...@apache.org> wrote:
>> > Hi,
>> >
>> > What would you expect when start and end delimiters are the same in
>> > combination with nested expression. Don't think that'll ever work.
>> > I assume that in your case @PoolSize.@ and @@ are evaluated.
>> > AFAIK only with different delimiters nested expressions could work.
>> >
>>
>> As long as the delimiters are matched, I would expect a recursive
>> resolution of them.
>>
>> That is,
>>
>> @foo@bar@@
>>
>> would first resolve the smallest part, @bar@ to something. Say
>> 'ResolvedBar'.
>> Then it should resolve the larger part @fooResolvedBar@ to whatever
>> 'fooResolvedBar' should be resolved to.
>>
>> That is the behaviour that I would like to see. And the behaviour I
>> interpret the closed bug is refering to.
>> https://issues.apache.org/jira/browse/MRESOURCES-70
>>
>> Just doing a token replacement token by token is easy to implement. A
>> recursive resolution is more complicated to implement.
>>
>> Cheers
>> Thomas
>>
>>
>> > thanks,
>> > Robert
>> >
>> > Op Wed, 13 Jan 2016 14:58:29 +0100 schreef Thomas Sundberg <ts...@kth.se>:
>> >
>> >
>> >> Hi!
>> >>
>> >> Filtering resources that uses @ as delimiters works.
>> >>
>> >> This example works as expected:
>> >> @Environment@
>> >>
>> >>
>> >> But my use case involves filtering nested resources. An example looks
>> like
>> >> this:
>> >>
>> >> @PoolSize.@Environment@@
>> >>
>> >> There seem to exist a closed bug regarding nested variables.
>> >> https://issues.apache.org/jira/browse/MRESOURCES-70
>> >>
>> >> Does anybody have another suggestion or should I implement my own
>> >> filtering as a custom resource filter?
>> >>
>> >> /Thomas
>> >>
>> >>
>> >> On 13 January 2016 at 12:04, James Hutton <ja...@gmail.com>
>> >> wrote:
>> >>>
>> >>> You could also look at DefaultMavenResourcesFiltering
>> >>>
>> >>> <
>> http://maven.apache.org/shared/maven-filtering/apidocs/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.html
>> >
>> >>> for
>> >>> an example. I think this is still using plexus so you'll have to have
>> the
>> >>> component.xml iirc that is needed for components.
>> >>>
>> >>> On Tue, Jan 12, 2016 at 5:33 PM, Baptiste Mathus <ml...@batmat.net>
>> wrote:
>> >>>
>> >>>> In general, though it would surely work too, better avoid using
>> >>>> maven-antrun-plugin.
>> >>>> Maven is about standardizing your build process, using antrun is gonna
>> >>>> add
>> >>>> issues with IDEs and so on.
>> >>>>
>> >>>> Anyway, what you ask for doesn't seem to me to require custom
>> filtering.
>> >>>> '@' is a standard delimiter (see
>> >>>>
>> >>>>
>> >>>>
>> http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters
>> >>>> ),
>> >>>> so it should work out of the box.
>> >>>>
>> >>>> Just enable filtering on the resources folders you want and you should
>> >>>> be
>> >>>> done.
>> >>>>
>> >>>> Cheers
>> >>>>
>> >>>>
>> >>>> 2016-01-12 23:26 GMT+01:00 Matt Benson <gu...@gmail.com>:
>> >>>>
>> >>>> > If you just want to get it done, use the maven-antrun-plugin with
>> Ant
>> >>>> > filtersets.
>> >>>> >
>> >>>> > Matt
>> >>>> >
>> >>>> > On Tue, Jan 12, 2016 at 4:14 PM, Thomas Sundberg <ts...@kth.se>
>> wrote:
>> >>>> > > Hi!
>> >>>> > >
>> >>>> > > I need to be able to filter files where the values to replace are
>> >>>> defind
>> >>>> > as
>> >>>> > >
>> >>>> > > @aPlaceHolderThatNeedToBeSubstituted@
>> >>>> > >
>> >>>> > > Does anyone know of a good, working example where a custom
>> resource
>> >>>> > > filter is implemented?
>> >>>> > >
>> >>>> > > I had a look at
>> >>>> > >
>> >>>> >
>> >>>>
>> >>>>
>> http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
>> >>>> > > and it is a bit sketchy. A complete, annotated example would be
>> nice
>> >>>> > > where all details needed to implement this interface
>> >>>> > > MavenResourcesFiltering are shared.
>> >>>> > >
>> >>>> > > A Git repo to clone would be the most awesome tip I can think of.
>> >>>> > >
>> >>>> > > Cheers,
>> >>>> > > Thomas
>> >>>> > >
>> >>>> > > --
>> >>>> > > Thomas Sundberg
>> >>>> > > M. Sc. in Computer Science
>> >>>> > >
>> >>>> > > Mobile: +46 70 767 33 15
>> >>>> > > Blog: http://thomassundberg.wordpress.com/
>> >>>> > > Twitter: @thomassundberg
>> >>>> > >
>> >>>> > > Better software through faster feedback
>> >>>> > >
>> >>>> > >
>> >>>> > >
>> ---------------------------------------------------------------------
>> >>>> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >>>> > > For additional commands, e-mail: users-help@maven.apache.org
>> >>>> > >
>> >>>> >
>> >>>> >
>> ---------------------------------------------------------------------
>> >>>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >>>> > For additional commands, e-mail: users-help@maven.apache.org
>> >>>> >
>> >>>> >
>> >>>>
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>>
>>
>>
>> --
>> Thomas Sundberg
>> M. Sc. in Computer Science
>>
>> Mobile: +46 70 767 33 15
>> Blog: http://thomassundberg.wordpress.com/
>> Twitter: @thomassundberg
>>
>> Better software through faster feedback
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>



-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

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


Re: Filtering resources

Posted by Stephen Connolly <st...@gmail.com>.
and how do I differentiate @foo@bar@@ whether that would be equivalent to
either:

 ${foo}bar${}

or

 ${foo${bar}}

if using ${ } style delimiters for the start and end?

At least with ${ } style delimiters one can count braces...

how about @foo@bar@manchu@ is that supposed to be ${foo${bar}manchu} or
${foo}bar${manchu}

Start trying to answer that question and you will see that the rules get
very fast very quickly

On 14 January 2016 at 09:10, Thomas Sundberg <ts...@kth.se> wrote:

> Hi!
>
> On 13 January 2016 at 19:01, Robert Scholte <rf...@apache.org> wrote:
> > Hi,
> >
> > What would you expect when start and end delimiters are the same in
> > combination with nested expression. Don't think that'll ever work.
> > I assume that in your case @PoolSize.@ and @@ are evaluated.
> > AFAIK only with different delimiters nested expressions could work.
> >
>
> As long as the delimiters are matched, I would expect a recursive
> resolution of them.
>
> That is,
>
> @foo@bar@@
>
> would first resolve the smallest part, @bar@ to something. Say
> 'ResolvedBar'.
> Then it should resolve the larger part @fooResolvedBar@ to whatever
> 'fooResolvedBar' should be resolved to.
>
> That is the behaviour that I would like to see. And the behaviour I
> interpret the closed bug is refering to.
> https://issues.apache.org/jira/browse/MRESOURCES-70
>
> Just doing a token replacement token by token is easy to implement. A
> recursive resolution is more complicated to implement.
>
> Cheers
> Thomas
>
>
> > thanks,
> > Robert
> >
> > Op Wed, 13 Jan 2016 14:58:29 +0100 schreef Thomas Sundberg <ts...@kth.se>:
> >
> >
> >> Hi!
> >>
> >> Filtering resources that uses @ as delimiters works.
> >>
> >> This example works as expected:
> >> @Environment@
> >>
> >>
> >> But my use case involves filtering nested resources. An example looks
> like
> >> this:
> >>
> >> @PoolSize.@Environment@@
> >>
> >> There seem to exist a closed bug regarding nested variables.
> >> https://issues.apache.org/jira/browse/MRESOURCES-70
> >>
> >> Does anybody have another suggestion or should I implement my own
> >> filtering as a custom resource filter?
> >>
> >> /Thomas
> >>
> >>
> >> On 13 January 2016 at 12:04, James Hutton <ja...@gmail.com>
> >> wrote:
> >>>
> >>> You could also look at DefaultMavenResourcesFiltering
> >>>
> >>> <
> http://maven.apache.org/shared/maven-filtering/apidocs/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.html
> >
> >>> for
> >>> an example. I think this is still using plexus so you'll have to have
> the
> >>> component.xml iirc that is needed for components.
> >>>
> >>> On Tue, Jan 12, 2016 at 5:33 PM, Baptiste Mathus <ml...@batmat.net>
> wrote:
> >>>
> >>>> In general, though it would surely work too, better avoid using
> >>>> maven-antrun-plugin.
> >>>> Maven is about standardizing your build process, using antrun is gonna
> >>>> add
> >>>> issues with IDEs and so on.
> >>>>
> >>>> Anyway, what you ask for doesn't seem to me to require custom
> filtering.
> >>>> '@' is a standard delimiter (see
> >>>>
> >>>>
> >>>>
> http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters
> >>>> ),
> >>>> so it should work out of the box.
> >>>>
> >>>> Just enable filtering on the resources folders you want and you should
> >>>> be
> >>>> done.
> >>>>
> >>>> Cheers
> >>>>
> >>>>
> >>>> 2016-01-12 23:26 GMT+01:00 Matt Benson <gu...@gmail.com>:
> >>>>
> >>>> > If you just want to get it done, use the maven-antrun-plugin with
> Ant
> >>>> > filtersets.
> >>>> >
> >>>> > Matt
> >>>> >
> >>>> > On Tue, Jan 12, 2016 at 4:14 PM, Thomas Sundberg <ts...@kth.se>
> wrote:
> >>>> > > Hi!
> >>>> > >
> >>>> > > I need to be able to filter files where the values to replace are
> >>>> defind
> >>>> > as
> >>>> > >
> >>>> > > @aPlaceHolderThatNeedToBeSubstituted@
> >>>> > >
> >>>> > > Does anyone know of a good, working example where a custom
> resource
> >>>> > > filter is implemented?
> >>>> > >
> >>>> > > I had a look at
> >>>> > >
> >>>> >
> >>>>
> >>>>
> http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
> >>>> > > and it is a bit sketchy. A complete, annotated example would be
> nice
> >>>> > > where all details needed to implement this interface
> >>>> > > MavenResourcesFiltering are shared.
> >>>> > >
> >>>> > > A Git repo to clone would be the most awesome tip I can think of.
> >>>> > >
> >>>> > > Cheers,
> >>>> > > Thomas
> >>>> > >
> >>>> > > --
> >>>> > > Thomas Sundberg
> >>>> > > M. Sc. in Computer Science
> >>>> > >
> >>>> > > Mobile: +46 70 767 33 15
> >>>> > > Blog: http://thomassundberg.wordpress.com/
> >>>> > > Twitter: @thomassundberg
> >>>> > >
> >>>> > > Better software through faster feedback
> >>>> > >
> >>>> > >
> >>>> > >
> ---------------------------------------------------------------------
> >>>> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>> > > For additional commands, e-mail: users-help@maven.apache.org
> >>>> > >
> >>>> >
> >>>> >
> ---------------------------------------------------------------------
> >>>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>> > For additional commands, e-mail: users-help@maven.apache.org
> >>>> >
> >>>> >
> >>>>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
>
>
> --
> Thomas Sundberg
> M. Sc. in Computer Science
>
> Mobile: +46 70 767 33 15
> Blog: http://thomassundberg.wordpress.com/
> Twitter: @thomassundberg
>
> Better software through faster feedback
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Filtering resources

Posted by Thomas Sundberg <ts...@kth.se>.
Hi!

On 13 January 2016 at 19:01, Robert Scholte <rf...@apache.org> wrote:
> Hi,
>
> What would you expect when start and end delimiters are the same in
> combination with nested expression. Don't think that'll ever work.
> I assume that in your case @PoolSize.@ and @@ are evaluated.
> AFAIK only with different delimiters nested expressions could work.
>

As long as the delimiters are matched, I would expect a recursive
resolution of them.

That is,

@foo@bar@@

would first resolve the smallest part, @bar@ to something. Say 'ResolvedBar'.
Then it should resolve the larger part @fooResolvedBar@ to whatever
'fooResolvedBar' should be resolved to.

That is the behaviour that I would like to see. And the behaviour I
interpret the closed bug is refering to.
https://issues.apache.org/jira/browse/MRESOURCES-70

Just doing a token replacement token by token is easy to implement. A
recursive resolution is more complicated to implement.

Cheers
Thomas


> thanks,
> Robert
>
> Op Wed, 13 Jan 2016 14:58:29 +0100 schreef Thomas Sundberg <ts...@kth.se>:
>
>
>> Hi!
>>
>> Filtering resources that uses @ as delimiters works.
>>
>> This example works as expected:
>> @Environment@
>>
>>
>> But my use case involves filtering nested resources. An example looks like
>> this:
>>
>> @PoolSize.@Environment@@
>>
>> There seem to exist a closed bug regarding nested variables.
>> https://issues.apache.org/jira/browse/MRESOURCES-70
>>
>> Does anybody have another suggestion or should I implement my own
>> filtering as a custom resource filter?
>>
>> /Thomas
>>
>>
>> On 13 January 2016 at 12:04, James Hutton <ja...@gmail.com>
>> wrote:
>>>
>>> You could also look at DefaultMavenResourcesFiltering
>>>
>>> <http://maven.apache.org/shared/maven-filtering/apidocs/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.html>
>>> for
>>> an example. I think this is still using plexus so you'll have to have the
>>> component.xml iirc that is needed for components.
>>>
>>> On Tue, Jan 12, 2016 at 5:33 PM, Baptiste Mathus <ml...@batmat.net> wrote:
>>>
>>>> In general, though it would surely work too, better avoid using
>>>> maven-antrun-plugin.
>>>> Maven is about standardizing your build process, using antrun is gonna
>>>> add
>>>> issues with IDEs and so on.
>>>>
>>>> Anyway, what you ask for doesn't seem to me to require custom filtering.
>>>> '@' is a standard delimiter (see
>>>>
>>>>
>>>> http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters
>>>> ),
>>>> so it should work out of the box.
>>>>
>>>> Just enable filtering on the resources folders you want and you should
>>>> be
>>>> done.
>>>>
>>>> Cheers
>>>>
>>>>
>>>> 2016-01-12 23:26 GMT+01:00 Matt Benson <gu...@gmail.com>:
>>>>
>>>> > If you just want to get it done, use the maven-antrun-plugin with Ant
>>>> > filtersets.
>>>> >
>>>> > Matt
>>>> >
>>>> > On Tue, Jan 12, 2016 at 4:14 PM, Thomas Sundberg <ts...@kth.se> wrote:
>>>> > > Hi!
>>>> > >
>>>> > > I need to be able to filter files where the values to replace are
>>>> defind
>>>> > as
>>>> > >
>>>> > > @aPlaceHolderThatNeedToBeSubstituted@
>>>> > >
>>>> > > Does anyone know of a good, working example where a custom resource
>>>> > > filter is implemented?
>>>> > >
>>>> > > I had a look at
>>>> > >
>>>> >
>>>>
>>>> http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
>>>> > > and it is a bit sketchy. A complete, annotated example would be nice
>>>> > > where all details needed to implement this interface
>>>> > > MavenResourcesFiltering are shared.
>>>> > >
>>>> > > A Git repo to clone would be the most awesome tip I can think of.
>>>> > >
>>>> > > Cheers,
>>>> > > Thomas
>>>> > >
>>>> > > --
>>>> > > Thomas Sundberg
>>>> > > M. Sc. in Computer Science
>>>> > >
>>>> > > Mobile: +46 70 767 33 15
>>>> > > Blog: http://thomassundberg.wordpress.com/
>>>> > > Twitter: @thomassundberg
>>>> > >
>>>> > > Better software through faster feedback
>>>> > >
>>>> > >
>>>> > > ---------------------------------------------------------------------
>>>> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> > > For additional commands, e-mail: users-help@maven.apache.org
>>>> > >
>>>> >
>>>> > ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> > For additional commands, e-mail: users-help@maven.apache.org
>>>> >
>>>> >
>>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>



-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

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


Re: Filtering resources

Posted by Robert Scholte <rf...@apache.org>.
Hi,

What would you expect when start and end delimiters are the same in  
combination with nested expression. Don't think that'll ever work.
I assume that in your case @PoolSize.@ and @@ are evaluated.
AFAIK only with different delimiters nested expressions could work.

thanks,
Robert

Op Wed, 13 Jan 2016 14:58:29 +0100 schreef Thomas Sundberg <ts...@kth.se>:

> Hi!
>
> Filtering resources that uses @ as delimiters works.
>
> This example works as expected:
> @Environment@
>
>
> But my use case involves filtering nested resources. An example looks  
> like this:
>
> @PoolSize.@Environment@@
>
> There seem to exist a closed bug regarding nested variables.
> https://issues.apache.org/jira/browse/MRESOURCES-70
>
> Does anybody have another suggestion or should I implement my own
> filtering as a custom resource filter?
>
> /Thomas
>
>
> On 13 January 2016 at 12:04, James Hutton <ja...@gmail.com>  
> wrote:
>> You could also look at DefaultMavenResourcesFiltering
>> <http://maven.apache.org/shared/maven-filtering/apidocs/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.html>
>> for
>> an example. I think this is still using plexus so you'll have to have  
>> the
>> component.xml iirc that is needed for components.
>>
>> On Tue, Jan 12, 2016 at 5:33 PM, Baptiste Mathus <ml...@batmat.net> wrote:
>>
>>> In general, though it would surely work too, better avoid using
>>> maven-antrun-plugin.
>>> Maven is about standardizing your build process, using antrun is gonna  
>>> add
>>> issues with IDEs and so on.
>>>
>>> Anyway, what you ask for doesn't seem to me to require custom  
>>> filtering.
>>> '@' is a standard delimiter (see
>>>
>>> http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters
>>> ),
>>> so it should work out of the box.
>>>
>>> Just enable filtering on the resources folders you want and you should  
>>> be
>>> done.
>>>
>>> Cheers
>>>
>>>
>>> 2016-01-12 23:26 GMT+01:00 Matt Benson <gu...@gmail.com>:
>>>
>>> > If you just want to get it done, use the maven-antrun-plugin with Ant
>>> > filtersets.
>>> >
>>> > Matt
>>> >
>>> > On Tue, Jan 12, 2016 at 4:14 PM, Thomas Sundberg <ts...@kth.se> wrote:
>>> > > Hi!
>>> > >
>>> > > I need to be able to filter files where the values to replace are
>>> defind
>>> > as
>>> > >
>>> > > @aPlaceHolderThatNeedToBeSubstituted@
>>> > >
>>> > > Does anyone know of a good, working example where a custom resource
>>> > > filter is implemented?
>>> > >
>>> > > I had a look at
>>> > >
>>> >
>>> http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
>>> > > and it is a bit sketchy. A complete, annotated example would be  
>>> nice
>>> > > where all details needed to implement this interface
>>> > > MavenResourcesFiltering are shared.
>>> > >
>>> > > A Git repo to clone would be the most awesome tip I can think of.
>>> > >
>>> > > Cheers,
>>> > > Thomas
>>> > >
>>> > > --
>>> > > Thomas Sundberg
>>> > > M. Sc. in Computer Science
>>> > >
>>> > > Mobile: +46 70 767 33 15
>>> > > Blog: http://thomassundberg.wordpress.com/
>>> > > Twitter: @thomassundberg
>>> > >
>>> > > Better software through faster feedback
>>> > >
>>> > >  
>>> ---------------------------------------------------------------------
>>> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> > > For additional commands, e-mail: users-help@maven.apache.org
>>> > >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> > For additional commands, e-mail: users-help@maven.apache.org
>>> >
>>> >
>>>
>
>

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


Re: Filtering resources

Posted by Thomas Sundberg <ts...@kth.se>.
Hi!

Filtering resources that uses @ as delimiters works.

This example works as expected:
@Environment@


But my use case involves filtering nested resources. An example looks like this:

@PoolSize.@Environment@@

There seem to exist a closed bug regarding nested variables.
https://issues.apache.org/jira/browse/MRESOURCES-70

Does anybody have another suggestion or should I implement my own
filtering as a custom resource filter?

/Thomas


On 13 January 2016 at 12:04, James Hutton <ja...@gmail.com> wrote:
> You could also look at DefaultMavenResourcesFiltering
> <http://maven.apache.org/shared/maven-filtering/apidocs/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.html>
> for
> an example. I think this is still using plexus so you'll have to have the
> component.xml iirc that is needed for components.
>
> On Tue, Jan 12, 2016 at 5:33 PM, Baptiste Mathus <ml...@batmat.net> wrote:
>
>> In general, though it would surely work too, better avoid using
>> maven-antrun-plugin.
>> Maven is about standardizing your build process, using antrun is gonna add
>> issues with IDEs and so on.
>>
>> Anyway, what you ask for doesn't seem to me to require custom filtering.
>> '@' is a standard delimiter (see
>>
>> http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters
>> ),
>> so it should work out of the box.
>>
>> Just enable filtering on the resources folders you want and you should be
>> done.
>>
>> Cheers
>>
>>
>> 2016-01-12 23:26 GMT+01:00 Matt Benson <gu...@gmail.com>:
>>
>> > If you just want to get it done, use the maven-antrun-plugin with Ant
>> > filtersets.
>> >
>> > Matt
>> >
>> > On Tue, Jan 12, 2016 at 4:14 PM, Thomas Sundberg <ts...@kth.se> wrote:
>> > > Hi!
>> > >
>> > > I need to be able to filter files where the values to replace are
>> defind
>> > as
>> > >
>> > > @aPlaceHolderThatNeedToBeSubstituted@
>> > >
>> > > Does anyone know of a good, working example where a custom resource
>> > > filter is implemented?
>> > >
>> > > I had a look at
>> > >
>> >
>> http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
>> > > and it is a bit sketchy. A complete, annotated example would be nice
>> > > where all details needed to implement this interface
>> > > MavenResourcesFiltering are shared.
>> > >
>> > > A Git repo to clone would be the most awesome tip I can think of.
>> > >
>> > > Cheers,
>> > > Thomas
>> > >
>> > > --
>> > > Thomas Sundberg
>> > > M. Sc. in Computer Science
>> > >
>> > > Mobile: +46 70 767 33 15
>> > > Blog: http://thomassundberg.wordpress.com/
>> > > Twitter: @thomassundberg
>> > >
>> > > Better software through faster feedback
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > > For additional commands, e-mail: users-help@maven.apache.org
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>>



-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

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


Re: Filtering resources

Posted by James Hutton <ja...@gmail.com>.
You could also look at DefaultMavenResourcesFiltering
<http://maven.apache.org/shared/maven-filtering/apidocs/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.html>
for
an example. I think this is still using plexus so you'll have to have the
component.xml iirc that is needed for components.

On Tue, Jan 12, 2016 at 5:33 PM, Baptiste Mathus <ml...@batmat.net> wrote:

> In general, though it would surely work too, better avoid using
> maven-antrun-plugin.
> Maven is about standardizing your build process, using antrun is gonna add
> issues with IDEs and so on.
>
> Anyway, what you ask for doesn't seem to me to require custom filtering.
> '@' is a standard delimiter (see
>
> http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters
> ),
> so it should work out of the box.
>
> Just enable filtering on the resources folders you want and you should be
> done.
>
> Cheers
>
>
> 2016-01-12 23:26 GMT+01:00 Matt Benson <gu...@gmail.com>:
>
> > If you just want to get it done, use the maven-antrun-plugin with Ant
> > filtersets.
> >
> > Matt
> >
> > On Tue, Jan 12, 2016 at 4:14 PM, Thomas Sundberg <ts...@kth.se> wrote:
> > > Hi!
> > >
> > > I need to be able to filter files where the values to replace are
> defind
> > as
> > >
> > > @aPlaceHolderThatNeedToBeSubstituted@
> > >
> > > Does anyone know of a good, working example where a custom resource
> > > filter is implemented?
> > >
> > > I had a look at
> > >
> >
> http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
> > > and it is a bit sketchy. A complete, annotated example would be nice
> > > where all details needed to implement this interface
> > > MavenResourcesFiltering are shared.
> > >
> > > A Git repo to clone would be the most awesome tip I can think of.
> > >
> > > Cheers,
> > > Thomas
> > >
> > > --
> > > Thomas Sundberg
> > > M. Sc. in Computer Science
> > >
> > > Mobile: +46 70 767 33 15
> > > Blog: http://thomassundberg.wordpress.com/
> > > Twitter: @thomassundberg
> > >
> > > Better software through faster feedback
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>

Re: Filtering resources

Posted by Baptiste Mathus <ml...@batmat.net>.
In general, though it would surely work too, better avoid using
maven-antrun-plugin.
Maven is about standardizing your build process, using antrun is gonna add
issues with IDEs and so on.

Anyway, what you ask for doesn't seem to me to require custom filtering.
'@' is a standard delimiter (see
http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters),
so it should work out of the box.

Just enable filtering on the resources folders you want and you should be
done.

Cheers


2016-01-12 23:26 GMT+01:00 Matt Benson <gu...@gmail.com>:

> If you just want to get it done, use the maven-antrun-plugin with Ant
> filtersets.
>
> Matt
>
> On Tue, Jan 12, 2016 at 4:14 PM, Thomas Sundberg <ts...@kth.se> wrote:
> > Hi!
> >
> > I need to be able to filter files where the values to replace are defind
> as
> >
> > @aPlaceHolderThatNeedToBeSubstituted@
> >
> > Does anyone know of a good, working example where a custom resource
> > filter is implemented?
> >
> > I had a look at
> >
> http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
> > and it is a bit sketchy. A complete, annotated example would be nice
> > where all details needed to implement this interface
> > MavenResourcesFiltering are shared.
> >
> > A Git repo to clone would be the most awesome tip I can think of.
> >
> > Cheers,
> > Thomas
> >
> > --
> > Thomas Sundberg
> > M. Sc. in Computer Science
> >
> > Mobile: +46 70 767 33 15
> > Blog: http://thomassundberg.wordpress.com/
> > Twitter: @thomassundberg
> >
> > Better software through faster feedback
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Filtering resources

Posted by Matt Benson <gu...@gmail.com>.
If you just want to get it done, use the maven-antrun-plugin with Ant
filtersets.

Matt

On Tue, Jan 12, 2016 at 4:14 PM, Thomas Sundberg <ts...@kth.se> wrote:
> Hi!
>
> I need to be able to filter files where the values to replace are defind as
>
> @aPlaceHolderThatNeedToBeSubstituted@
>
> Does anyone know of a good, working example where a custom resource
> filter is implemented?
>
> I had a look at
> http://maven.apache.org/plugins/maven-resources-plugin/examples/custom-resource-filters.html
> and it is a bit sketchy. A complete, annotated example would be nice
> where all details needed to implement this interface
> MavenResourcesFiltering are shared.
>
> A Git repo to clone would be the most awesome tip I can think of.
>
> Cheers,
> Thomas
>
> --
> Thomas Sundberg
> M. Sc. in Computer Science
>
> Mobile: +46 70 767 33 15
> Blog: http://thomassundberg.wordpress.com/
> Twitter: @thomassundberg
>
> Better software through faster feedback
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

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