[ 
https://issues.apache.org/jira/browse/MRESOURCES-254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17161937#comment-17161937
 ] 

Andre Brait edited comment on MRESOURCES-254 at 7/21/20, 10:44 AM:
-------------------------------------------------------------------

Sure. Here's an updated test project.[^test-updated.zip]

If you run {{mvn clean compile exec:exec}}, you'll see that using 
{{<prop8>@buildNumber@</prop8>}} will work for filtering, but not when using 
the property {{prop8}} inside the pom.xml with the Maven Exec Plugin. 
{noformat}
<executable>echo</executable>
<arguments>
  <!-- Testing properties used inside the pom -->
  <argument>All these work here:</argument>
  <argument>prop1=${prop1}</argument>
  <argument>prop2=${prop2}</argument>
  <argument>prop3=${prop3}</argument>
  <argument>prop4=${prop4}</argument>
  <argument>prop5=${prop5}</argument>
  <argument>prop6=${prop6}</argument>
  <argument>prop7=${prop7}.</argument>
  <argument>However, this will only work for filtering: </argument>
  <argument>prop8=${prop8}.</argument>
</arguments> {noformat}
Will print something like this:
{noformat}
All these work here: prop1=1 prop2=1-2 
prop3=1-bd21456b9948651e53b4985d20c87b99973289b7 
prop4=1-2-bd21456b9948651e53b4985d20c87b99973289b7 
prop5=1-2-1-bd21456b9948651e53b4985d20c87b99973289b7 prop6=1-1-2 
prop7=bd21456b9948651e53b4985d20c87b99973289b7. However, this will only work 
for filtering: prop8=@buildNumber@.{noformat}
 

So, if I wanted to use, let's say, buildNumber both inside the pom and for 
filtering, I would need to create two properties, one with {{$\{buildNumber}}} 
and another one with {{@buildNumber@}} and use one for filtering and another 
one inside the pom.

 

Input filtered text file:
{noformat}
Check this file after the filtering!

This does: @prop1@
And this one too: @prop2@
This doens't work: @prop3@
This also doesn't: @prop4@
And this also doesn't: @prop4@
And this also doesn't, again: @prop5@
But this does: @prop6@
Then again, this doesn't: @prop7@
This works, but only for filtering: @prop8@

Using the property directly works too: @buildNumber@
{noformat}
Output:
{noformat}
Check this file after the filtering!

This does: 1
And this one too: 1-2
This doens't work: 1-${buildNumber}
This also doesn't: 1-2-${buildNumber}
And this also doesn't: 1-2-${buildNumber}
And this also doesn't, again: 1-2-1-${buildNumber}
But this does: 1-1-2
Then again, this doesn't: ${buildNumber}
This works, but only for filtering: bd21456b9948651e53b4985d20c87b99973289b7

Using the property directly works too: bd21456b9948651e53b4985d20c87b99973289b7
{noformat}


was (Author: andrebrait):
Sure. Here's an updated test project.[^test-updated.zip]

If you run {{mvn clean compile exec:exec}}, you'll see that using 
{{<prop8>@buildNumber@</prop8>}} will work for filtering, but not when using 
the property {{prop8}} inside the pom.xml with the Maven Exec Plugin. 
{noformat}
<executable>echo</executable>
<arguments>
  <!-- Testing properties used inside the pom -->
  <argument>All these work here:</argument>
  <argument>prop1=${prop1}</argument>
  <argument>prop2=${prop2}</argument>
  <argument>prop3=${prop3}</argument>
  <argument>prop4=${prop4}</argument>
  <argument>prop5=${prop5}</argument>
  <argument>prop6=${prop6}</argument>
  <argument>prop7=${prop7}.</argument>
  <argument>However, this will only work for filtering: </argument>
  <argument>prop8=${prop8}.</argument>
</arguments> {noformat}
Will print something like this:
{noformat}
All these work here: prop1=1 prop2=1-2 
prop3=1-bd21456b9948651e53b4985d20c87b99973289b7 
prop4=1-2-bd21456b9948651e53b4985d20c87b99973289b7 
prop5=1-2-1-bd21456b9948651e53b4985d20c87b99973289b7 prop6=1-1-2 
prop7=bd21456b9948651e53b4985d20c87b99973289b7. However, this will only work 
for filtering: prop8=@buildNumber@.{noformat}
 

So, if I wanted to use, let's say, buildNumber both inside the pom and for 
filtering, I would need to create two properties, one with {{$\{buildNumber}}} 
and another one with {{@buildNumber}} and use one for filtering and another one 
inside the pom.

 

Input filtered text file:
{noformat}
Check this file after the filtering!

This does: @prop1@
And this one too: @prop2@
This doens't work: @prop3@
This also doesn't: @prop4@
And this also doesn't: @prop4@
And this also doesn't, again: @prop5@
But this does: @prop6@
Then again, this doesn't: @prop7@
This works, but only for filtering: @prop8@

Using the property directly works too: @buildNumber@
{noformat}
Output:
{noformat}
Check this file after the filtering!

This does: 1
And this one too: 1-2
This doens't work: 1-${buildNumber}
This also doesn't: 1-2-${buildNumber}
And this also doesn't: 1-2-${buildNumber}
And this also doesn't, again: 1-2-1-${buildNumber}
But this does: 1-1-2
Then again, this doesn't: ${buildNumber}
This works, but only for filtering: bd21456b9948651e53b4985d20c87b99973289b7

Using the property directly works too: bd21456b9948651e53b4985d20c87b99973289b7
{noformat}

> Filtering of compound properties using properties added by other plugins 
> fails without ${*} delimiter
> -----------------------------------------------------------------------------------------------------
>
>                 Key: MRESOURCES-254
>                 URL: https://issues.apache.org/jira/browse/MRESOURCES-254
>             Project: Maven Resources Plugin
>          Issue Type: Bug
>          Components: delimiters, filtering
>    Affects Versions: 3.1.0
>            Reporter: Andre Brait
>            Priority: Major
>         Attachments: test-updated.zip, test.zip
>
>
> How to reproduce:
>  # Open the project I attached here
>  # Run mvn clean compile
>  # Check that the file target/classes/someText.txt has a compund property 
> that was incorrectly filtered
>  # Set useDefaultDelimiters to true and run mvn clean compile again
>  # Check that the file target/classes/someText.txt was now filtered properly



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to