You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> on 2009/09/24 13:50:08 UTC

Maven Resource Plugin - Filtering: How to configure custom Token to be filtered

Hi,

i want to migrate from antmod to maven.
I wonder if it is possible to configure additional tokens to replace my 
property placeholders ( not only @...@ and ${....} ).

I want to replace $....$ ones.

I've read http://maven.apache.org/shared/maven-filtering/usage.html but 
looking at latest trunk or beta3 of the maven shared component the docs 
mention MavenProjectValueSource which is gone already and does only exist in 
beta2 anymore (exists only up to revision 806645).

So what would be the best way to get my custom token filtered?
Is it configurable or have i have to write my own resource mojo (against trunk 
version or beta3, what must be done as the example is outdated, isn't it?).

thx for help

Torsten


-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
	-- Linus Torvalds

Re: Maven Resource Plugin - Filtering: How to configure custom Token to be filtered

Posted by Olivier Lamy <ol...@apache.org>.
probably a bug. (I have to investigate more)
Can you create a issue [1] and attach a simple project to reproduce the issue.

Thanks !
--
Olivier
[1] http://jira.codehaus.org/browse/MRESOURCES

2009/9/24 Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>:
> Am Donnerstag, 24. September 2009 13:55:08 schrieb Olivier Lamy:
>> Have a look at delimiters [1] parameters in the resources mojo
>
> Hi, thx for this hint.
> Did have a look there - delimiters does sounds nice (i need to turn off
> useDefaultDelimiters to get them respected), however its not working as
> expected (at least expected by me ;-)).
>
>
> <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-resources-plugin</artifactId>
>        <version>2.4</version>
>        <configuration>
>                <useDefaultDelimiters>false</useDefaultDelimiters>
>                <delimiters>
>                        <delimiter>$</delimiter>
>                        <delimiter>@</delimiter>
>                        <delimiter>#</delimiter>
>                        <delimiter>${*}</delimiter>
>                </delimiters>
>                <encoding>UTF-8</encoding>
>        </configuration>
> </plugin>
>
> Using this i get a NullPointerException:
> java.lang.NullPointerException
>        at
> org.codehaus.plexus.interpolation.multi.DelimiterSpecification.parse(DelimiterSpecification.java:54)
>        at
> org.codehaus.plexus.interpolation.multi.MultiDelimiterStringSearchInterpolator.setDelimiterSpecs(MultiDelimiterStringSearchInterpolator.java:394)
>
>
> Removing the ${*} (although the docs does mention it as valid and i would like
> to use it too) it runs but not working like expected:
>
> Some exampled i tried:
>
> mvn clean resources:resource -Dtest.value=true
>
> As example using this property file:
>
> test.value=$test.value$
> test.value=#test.value#
> test.value=@test.value@
> test.value=${test.value}
>
> Using only:
>
> <delimiter>$</delimiter>
> <delimiter>@</delimiter>
>
> i get this result:
>
> test.value=true
> test.value=#test.value#
> test.value=true
> test.value=${test.value}
>
> Using this one:
>
> <delimiter>$</delimiter>
> <delimiter>@</delimiter>
> <delimiter>#</delimiter>
>
> the result is:
>
> test.value=true
> test.value=#test.value#
> test.value=@test.value@
> test.value=${test.value}
>
>
> Whats wrong here? Did i miss something or is my plugin configuration
> incorrect? Might this be a bug?
>
>
> Torsten
>
> --
> Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
> Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html
>
> Really, I'm not out to destroy Microsoft. That will just be a
> completely unintentional side effect."
>        -- Linus Torvalds
>



-- 
Olivier

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


Re: Maven Resource Plugin - Filtering: How to configure custom Token to be filtered

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Am Donnerstag, 24. September 2009 13:55:08 schrieb Olivier Lamy:
> Have a look at delimiters [1] parameters in the resources mojo

Hi, thx for this hint.
Did have a look there - delimiters does sounds nice (i need to turn off 
useDefaultDelimiters to get them respected), however its not working as 
expected (at least expected by me ;-)).


<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-resources-plugin</artifactId>
	<version>2.4</version>
	<configuration>
		<useDefaultDelimiters>false</useDefaultDelimiters>
		<delimiters>
			<delimiter>$</delimiter>
			<delimiter>@</delimiter>
			<delimiter>#</delimiter>
			<delimiter>${*}</delimiter>
		</delimiters>
		<encoding>UTF-8</encoding>
	</configuration>
</plugin>

Using this i get a NullPointerException:
java.lang.NullPointerException
	at 
org.codehaus.plexus.interpolation.multi.DelimiterSpecification.parse(DelimiterSpecification.java:54)
	at 
org.codehaus.plexus.interpolation.multi.MultiDelimiterStringSearchInterpolator.setDelimiterSpecs(MultiDelimiterStringSearchInterpolator.java:394)


Removing the ${*} (although the docs does mention it as valid and i would like 
to use it too) it runs but not working like expected:

Some exampled i tried:

mvn clean resources:resource -Dtest.value=true

As example using this property file:

test.value=$test.value$
test.value=#test.value#
test.value=@test.value@
test.value=${test.value}

Using only:

<delimiter>$</delimiter>
<delimiter>@</delimiter>

i get this result:

test.value=true
test.value=#test.value#
test.value=true
test.value=${test.value}

Using this one:

<delimiter>$</delimiter>
<delimiter>@</delimiter>
<delimiter>#</delimiter>

the result is:

test.value=true
test.value=#test.value#
test.value=@test.value@
test.value=${test.value}


Whats wrong here? Did i miss something or is my plugin configuration 
incorrect? Might this be a bug?


Torsten

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
	-- Linus Torvalds

Re: Maven Resource Plugin - Filtering: How to configure custom Token to be filtered

Posted by Olivier Lamy <ol...@apache.org>.
Hi,
Have a look at delimiters [1] parameters in the resources mojo

HTH,
--
Olivier
http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters

2009/9/24 Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>:
> Hi,
>
> i want to migrate from antmod to maven.
> I wonder if it is possible to configure additional tokens to replace my
> property placeholders ( not only @...@ and ${....} ).
>
> I want to replace $....$ ones.
>
> I've read http://maven.apache.org/shared/maven-filtering/usage.html but
> looking at latest trunk or beta3 of the maven shared component the docs
> mention MavenProjectValueSource which is gone already and does only exist in
> beta2 anymore (exists only up to revision 806645).
>
> So what would be the best way to get my custom token filtered?
> Is it configurable or have i have to write my own resource mojo (against trunk
> version or beta3, what must be done as the example is outdated, isn't it?).
>
> thx for help
>
> Torsten
>
>
> --
> Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
> Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html
>
> Really, I'm not out to destroy Microsoft. That will just be a
> completely unintentional side effect."
>        -- Linus Torvalds
>



-- 
Olivier

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