You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "hboutemy (via GitHub)" <gi...@apache.org> on 2023/11/05 07:48:33 UTC
[PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
hboutemy opened a new pull request, #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236
clarify something which precise scope was unclear until now (at least to me)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382636597
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
so do we all now agree that using `@Component` is better than using `@Parameter( defaultValue = "${session}", readonly = true )` (because smaller and moreover we're sure there is no typo in the default value expression)?
if we agree, the warning could be to promote switch to `@Component` for `${session}`, `${project}` and `${mojoExecution}`...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "asfgit (via GitHub)" <gi...@apache.org>.
asfgit merged PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382594121
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
> > We were discussing and leaning to the exact opposite. Keep `@Parameter` for things injected from the config and `@Component/@Inject` for injecting beans, including those from the session (Session) and mojoExecution scopes (MojoExecution, Project)...
>
> This is exactly what I remember. Use `@Parameter` exactly for this case.
But those components can also be injected with `@Component`, so this is weird to warn about something that is supported by sisu (because those are actually bound to scopes), while pushing users to a _custom_ solution. Why only a few components would be accessible by name then ?
I would agree if we had a single annotation for both use cases, but that's not the case in Maven 3. I suppose we could try for the v4 api though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382636597
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
and do we now agree that using `@Component` is better than using `@Parameter( defaultValue = "${session}", readonly = true )` (because smaller and moreover we're sure there is no typo in the default value expression)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "asfgit (via GitHub)" <gi...@apache.org>.
asfgit closed pull request #236: [MNG-5695] document Maven 3.2.5+ scoped components usage
URL: https://github.com/apache/maven-plugin-tools/pull/236
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382637654
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
reading git blame on https://github.com/apache/maven-plugin-tools/blob/master/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java#L791 , I see that in the past, we (I :) ) implemented in plugin-tools a hack to replace `@Component` with an expression in the plugin descriptor: https://issues.apache.org/jira/browse/MPLUGIN-204
It was was done when we were with Maven 3.0.x, if it was before Maven 3.2.5 MNG-5695. With Maven 3.2.5, this hack is not useful any more for `MavenSession`, `MavenProject` nor `MojoExecution`: it remains useful for a few other types...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382592626
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
> We were discussing and leaning to the exact opposite. Keep `@Parameter` for things injected from the config and `@Component/@Inject` for injecting beans, including those from the session (Session) and mojoExecution scopes (MojoExecution, Project)...
This is exactly what I remember. Use `@Parameter` exactly for this case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382636597
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
and do we all now agree that using `@Component` is better than using `@Parameter( defaultValue = "${session}", readonly = true )` (because smaller and moreover we're sure there is no typo in the default value expression)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#issuecomment-1794131746
now that we've found back the MPLUGIN-204 hack, in the proposed update:
```
@Component // since Maven 3.2.5, thanks to MNG-5695
```
we could perhaps drop the comment on Maven 3.2.5 because the plugin transforms `@Component` with `@Parameter`, then it works with any Maven release
the only improvement that could be useful is to NOT transform but keep a real Plexus component if the plugin is targetting 3.2.5+: I don't know if this is feasible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#issuecomment-1869075954
Are we good to merge this? We have two approvals.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#issuecomment-1870647715
I took the stab now and change the code: #253. Both PRs should go together in the next release.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#issuecomment-1809312591
on latest discussions on Slack (I hate non-shared Slack diuscussions), there is also the `@Inject` options that IIUC completely avoids the plugin descriptor intermediate= `<requirement` in https://maven.apache.org/ref/3.9.5/maven-plugin-api/plugin.html
I don't know if it works, never tried
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382637654
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
reading git blame on https://github.com/apache/maven-plugin-tools/blob/master/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java#L791 , I see that in the past, we (I :) ) implemented in plugin-tools a hack to replace `@Component` with an expression in the plugin descriptor: https://issues.apache.org/jira/browse/MPLUGIN-204
I don't remember when this was done, if it was before Maven 3.2.5 MNG-5695, but with Maven 3.2.5, this hack is not useful for `MavenSession`, `MavenProject` nor `MojoExecution`: it remains useful for a few other types...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382636597
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
so do we all now agree that using `@Component` is better than using `@Parameter( defaultValue = "${session}", readonly = true )` (because smaller and moreover we're sure there is no typo in the default value expression)?
if we agree, the warning could be to promote switch to `@Component`...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382637412
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
> and do we all now agree that using `@Component` is better than using `@Parameter( defaultValue = "${session}", readonly = true )` (because smaller and moreover we're sure there is no typo in the default value expression)?
>
> if we agree, the warning could be to promote switch to `@Component`...
From my PoV, is this cannot be provided by POM or CLI means and it is unambiguous, then yes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1383237666
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
IMHO there is no problem when JSR330 being used. Problem happens when Mojo APIs (java5 anno or javadoc annos are being used).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382564308
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
We were discussing and leaning to the exact opposite.
Keep `@Parameter` for things injected from the config and `@Component/@Inject` for injecting beans, including those from the session (Session) and mojoExecution scopes (MojoExecution, Project)...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382595128
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
> > > We were discussing and leaning to the exact opposite. Keep `@Parameter` for things injected from the config and `@Component/@Inject` for injecting beans, including those from the session (Session) and mojoExecution scopes (MojoExecution, Project)...
> >
> >
> > This is exactly what I remember. Use `@Parameter` exactly for this case.
>
> But those components can also be injected with `@Component`, so this is weird to warn about something that is supported by sisu (because those are actually bound to scopes), while pushing users to a _custom_ solution. Why only a few components would be accessible by name then ? I would agree if we had a single annotation for both use cases, but that's not the case in Maven 3. I suppose we could try for the v4 api though.
I agree that this is inconsistent. If both are valid and are functionally identical then the warning is warong.
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
> > > We were discussing and leaning to the exact opposite. Keep `@Parameter` for things injected from the config and `@Component/@Inject` for injecting beans, including those from the session (Session) and mojoExecution scopes (MojoExecution, Project)...
> >
> >
> > This is exactly what I remember. Use `@Parameter` exactly for this case.
>
> But those components can also be injected with `@Component`, so this is weird to warn about something that is supported by sisu (because those are actually bound to scopes), while pushing users to a _custom_ solution. Why only a few components would be accessible by name then ? I would agree if we had a single annotation for both use cases, but that's not the case in Maven 3. I suppose we could try for the v4 api though.
I agree that this is inconsistent. If both are valid and are functionally identical then the warning is wrong.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#issuecomment-1794214621
in MPLUGIN-204 we advised using `@Component` (that would use the trick to transform to parameters in the plugin descriptor XML), but later we advised back: https://github.com/apache/maven-plugin-tools/commit/f8a946df81176cfdf4be2f37c04b881b961d6994
see https://issues.apache.org/jira/browse/MPLUGIN-257
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382637654
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
reading git blame, I see that in the past, we (I :) ) implemented in plugin-tools a hack to replace `@Component` with an expression in the plugin descriptor: https://issues.apache.org/jira/browse/MPLUGIN-204
I don't remember when this was done, if it was before Maven 3.2.5 MNG-5695, but with Maven 3.2.5, this hack is not useful for `MavenSession`, `MavenProject` nor `MojoExecution`: it remains useful for a few other types...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382636597
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
and do we all now agree that using `@Component` is better than using `@Parameter( defaultValue = "${session}", readonly = true )` (because smaller and moreover we're sure there is no typo in the default value expression)?
if we agree, the warning could be to promote switch to `@Component`...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on code in PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#discussion_r1382531856
##########
maven-plugin-tools-annotations/src/site/apt/index.apt:
##########
@@ -94,27 +94,42 @@ public class MyMojo
hint = "..." )
private MyComponent component;
+ // pseudo-parameters (marked read-only) permitting injection of Maven build context objects
// sample objects taken from Maven API through PluginParameterExpressionEvaluator
+ // https://maven.apache.org/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html
+ // plugins targetting Maven 3.2.5+ (after MNG-5695) should not use these pseudo-parameters any more,
+ // but @Component and Maven APIs to get better compiler-time checks
- @Parameter( defaultValue = "${session}", readonly = true )
+ // @Parameter( defaultValue = "${session}", readonly = true )
+ @Component // since Maven 3.2.5, thanks to MNG-5695
Review Comment:
We have a warning for such components ...
https://github.com/apache/maven-plugin-tools/blob/master/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java#L61
and Component is replaced by expression
https://github.com/apache/maven-plugin-tools/blob/master/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java#L791
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#issuecomment-1794259016
> in [MPLUGIN-204](https://issues.apache.org/jira/browse/MPLUGIN-204) we advised using `@Component` (that would use the trick to transform to parameters in the plugin descriptor XML), but later we advised back: [f8a946d](https://github.com/apache/maven-plugin-tools/commit/f8a946df81176cfdf4be2f37c04b881b961d6994) see https://issues.apache.org/jira/browse/MPLUGIN-257
That's exactly what I don't understand. Since they are bound to a scope in plexus, they _are_ plexus components, even if they have not been instantiated by plexus.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#issuecomment-1809309881
before Maven 3.2.5, they were not Plexus components: then implementation in plexus-tools was a hack to replace with parameter in plugin descriptor XML
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MNG-5695] document Maven 3.2.5+ scoped components usage [maven-plugin-tools]
Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on PR #236:
URL: https://github.com/apache/maven-plugin-tools/pull/236#issuecomment-1869096681
> We also should remove replacements and worning form code:
>
> https://github.com/apache/maven-plugin-tools/blob/master/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java#L791
>
> changing only documentation users will be confused when use it
Right, it needs to be consistent. @cstamas, your turn.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org