maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Sundberg <...@kth.se>
Subject Re: Filtering resources
Date Thu, 14 Jan 2016 09:10:35 GMT
Hi!

On 13 January 2016 at 19:01, Robert Scholte <rfscholte@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 <tsu@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 <james.a.hutton@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 <gudnabrsam@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 <tsu@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


Mime
View raw message