DefaultMavenReaderFilter API does not correctly interpolate collection variables

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

DefaultMavenReaderFilter API does not correctly interpolate collection variables

Simone Tripodi-2
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":"[org.apache.maven.model.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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DefaultMavenReaderFilter API does not correctly interpolate collection variables

Robert Scholte-3
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 <[hidden email]> Datum: 15-10-18  12:12  (GMT+03:00) Aan: Maven Developers List <[hidden email]> 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":"[org.apache.maven.model.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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DefaultMavenReaderFilter API does not correctly interpolate collection variables

olamy
In reply to this post by Simone Tripodi-2
correct ATM we don't really have interpolation in such scripted way :(


On Tue, 16 Oct 2018 at 18:07, Robert Scholte <[hidden email]>
wrote:

> 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 <
> [hidden email]> Datum: 15-10-18  12:12  (GMT+03:00) Aan: Maven
> Developers List <[hidden email]> 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":"[org.apache.maven.model.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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy
Reply | Threaded
Open this post in threaded view
|

Re: DefaultMavenReaderFilter API does not correctly interpolate collection variables

Simone Tripodi-2
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
On Tue, Oct 16, 2018 at 10:12 AM Olivier Lamy <[hidden email]> wrote:

>
> correct ATM we don't really have interpolation in such scripted way :(
>
>
> On Tue, 16 Oct 2018 at 18:07, Robert Scholte <[hidden email]>
> wrote:
>
> > 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 <
> > [hidden email]> Datum: 15-10-18  12:12  (GMT+03:00) Aan: Maven
> > Developers List <[hidden email]> 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":"[org.apache.maven.model.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: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> --
> Olivier Lamy
> http://twitter.com/olamy | http://linkedin.com/in/olamy

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]