Discussion:
DefaultMavenReaderFilter API does not correctly interpolate collection variables
Simone Tripodi
2018-10-15 09:12:08 UTC
Permalink
Hi all mates,

I am writing a plugin which needs to filter & then process resources,
I am using the DefaultMavenReaderFilter API below:

DefaultMavenReaderFilter#filter( Reader, boolean, MavenProject,
List<String>, boolean, MavenSession )

in my resource I declared few variables that have to be interpolated,
everything works except:

"license": "${project.licenses[0].name}"

which is not interpolated and keeps to be represented as the original
string; if I try to replace it with

"license": "${project.licenses}",

it is correctly interpolated as

"license":"[***@30135202]"

Any idea what is wrong?
Many thanks in advance!
~Simo

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@maven.apache.org
For additional commands, e-mail: dev-***@maven.apache.org
Robert Scholte
2018-10-16 08:07:15 UTC
Permalink
I recognize the issue,  but never paid attention to it since in general it doesn't make sense to access any listing entry in the pom by index. I have no solution here. 
Robert
Verzonden vanaf mijn Samsung Galaxy-smartphone.
-------- Oorspronkelijk bericht --------Van: Simone Tripodi <***@apache.org> Datum: 15-10-18 12:12 (GMT+03:00) Aan: Maven Developers List <***@maven.apache.org> Onderwerp: DefaultMavenReaderFilter API does not correctly interpolate
  collection variables
Hi all mates,

I am writing a plugin which needs to filter & then process resources,
I am using the DefaultMavenReaderFilter API below:

DefaultMavenReaderFilter#filter( Reader, boolean, MavenProject,
List<String>, boolean, MavenSession )

in my resource I declared few variables that have to be interpolated,
everything works except:

  "license": "${project.licenses[0].name}"

which is not interpolated and keeps to be represented as the original
string; if I try to replace it with

  "license": "${project.licenses}",

it is correctly interpolated as

  "license":"[***@30135202]"

Any idea what is wrong?
Many thanks in advance!
~Simo

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@maven.apache.org
For additional commands, e-mail: dev-***@maven.apache.org
Olivier Lamy
2018-10-16 08:12:03 UTC
Permalink
correct ATM we don't really have interpolation in such scripted way :(
I recognize the issue, but never paid attention to it since in general it
doesn't make sense to access any listing entry in the pom by index. I have
no solution here.
Robert
Verzonden vanaf mijn Samsung Galaxy-smartphone.
-------- Oorspronkelijk bericht --------Van: Simone Tripodi <
DefaultMavenReaderFilter API does not correctly interpolate
collection variables
Hi all mates,
I am writing a plugin which needs to filter & then process resources,
DefaultMavenReaderFilter#filter( Reader, boolean, MavenProject,
List<String>, boolean, MavenSession )
in my resource I declared few variables that have to be interpolated,
"license": "${project.licenses[0].name}"
which is not interpolated and keeps to be represented as the original
string; if I try to replace it with
"license": "${project.licenses}",
it is correctly interpolated as
Any idea what is wrong?
Many thanks in advance!
~Simo
http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi
---------------------------------------------------------------------
--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy
Simone Tripodi
2018-10-16 08:20:58 UTC
Permalink
Thanks both for your kind reply, very appreciated!

I was sure Plexus Interpolator supported that so I had the trouble I
was doing something wrong at API level :)

Keep up the good work, all the best!
~Simo

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi
Post by Olivier Lamy
correct ATM we don't really have interpolation in such scripted way :(
I recognize the issue, but never paid attention to it since in general it
doesn't make sense to access any listing entry in the pom by index. I have
no solution here.
Robert
Verzonden vanaf mijn Samsung Galaxy-smartphone.
-------- Oorspronkelijk bericht --------Van: Simone Tripodi <
DefaultMavenReaderFilter API does not correctly interpolate
collection variables
Hi all mates,
I am writing a plugin which needs to filter & then process resources,
DefaultMavenReaderFilter#filter( Reader, boolean, MavenProject,
List<String>, boolean, MavenSession )
in my resource I declared few variables that have to be interpolated,
"license": "${project.licenses[0].name}"
which is not interpolated and keeps to be represented as the original
string; if I try to replace it with
"license": "${project.licenses}",
it is correctly interpolated as
Any idea what is wrong?
Many thanks in advance!
~Simo
http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi
---------------------------------------------------------------------
--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@maven.apache.org
For additional commands, e-mail: dev-***@maven.apache.org
Gabriel Belingueres
2018-10-18 02:14:27 UTC
Permalink
Hi Simone:

Please check if you can safely upgrade your plexus-interpolation
dependency, as support to interpolate on arrays/lists/maps was deleted at
some point, but then added again in version 1.24.

Regards,
Gabriel

El mar., 16 de oct. de 2018 a la(s) 05:24, Simone Tripodi (
Post by Simone Tripodi
Thanks both for your kind reply, very appreciated!
I was sure Plexus Interpolator supported that so I had the trouble I
was doing something wrong at API level :)
Keep up the good work, all the best!
~Simo
http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi
Post by Olivier Lamy
correct ATM we don't really have interpolation in such scripted way :(
I recognize the issue, but never paid attention to it since in
general it
Post by Olivier Lamy
doesn't make sense to access any listing entry in the pom by index. I
have
Post by Olivier Lamy
no solution here.
Robert
Verzonden vanaf mijn Samsung Galaxy-smartphone.
-------- Oorspronkelijk bericht --------Van: Simone Tripodi <
Maven
Post by Olivier Lamy
DefaultMavenReaderFilter API does not correctly interpolate
collection variables
Hi all mates,
I am writing a plugin which needs to filter & then process resources,
DefaultMavenReaderFilter#filter( Reader, boolean, MavenProject,
List<String>, boolean, MavenSession )
in my resource I declared few variables that have to be interpolated,
"license": "${project.licenses[0].name}"
which is not interpolated and keeps to be represented as the original
string; if I try to replace it with
"license": "${project.licenses}",
it is correctly interpolated as
Any idea what is wrong?
Many thanks in advance!
~Simo
http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi
---------------------------------------------------------------------
--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
Loading...