[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17721082#comment-17721082 ] Steven R. Loomis commented on MNG-7754: --- I think it's fine here. > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Improvement > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17721063#comment-17721063 ] Michael Osipov commented on MNG-7754: - So all is good now? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Improvement > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17721059#comment-17721059 ] Michael Osipov commented on MNG-7754: - [~srloomis], I do agree with you. It provide too little context for the average developer. [~cstamas], back to the formula? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Improvement > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17721057#comment-17721057 ] Steven R. Loomis commented on MNG-7754: --- Hi. I'm not sure how the error message is an improvement towards the stated goals. This message above says: "Some users… immediately grep their {{$HOME}} to find out that they DO HAVE afore mentioned string present in their {{settings.xml"}} I wouldn't know to do that. I'm just a developer, not a plugin developer. I don't have that string anywhere in my {{pom.xml}} nor in any {{settings.xml}} now that you say it. I do have that string in various places in {{{}~/.m2/*{}}}. {code:java} [INFO] --- surefire:2.22.2:test (default-test) @ cldr-code --- [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead. {code} So, what can I do? I suppose I could try to upgrade surefire to 3.1.0? Sure enough that seems to fix it. Perhaps the error message should say: "Try upgrading " ? But there's not enough context to understand the error message. I certainly don't pass any parameter {{localRepository}} to the surefire plugin. As I write this it's still not clear what the error is/was. What's a core expression or an LRM? Should the message blame _surefire_ (for example) as accessing a core expression (if indeed it did). A confused user. Found this ticket by a web search. Thanks. > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Improvement > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17711277#comment-17711277 ] Tamas Cservenak commented on MNG-7754: -- Merged as: maven-3.9.x: https://github.com/apache/maven/commit/36a4e9ff644850a96cfd173cda95819a8836e833 master: https://github.com/apache/maven/commit/cfc6798b9604eccc82664f1c7b83c70533ee9994 > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17711274#comment-17711274 ] ASF GitHub Bot commented on MNG-7754: - cstamas merged PR #1079: URL: https://github.com/apache/maven/pull/1079 > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=1770#comment-1770 ] ASF GitHub Bot commented on MNG-7754: - kwin commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1163313730 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DeprecatedCoreExpressionValidator.java: ## @@ -49,21 +52,32 @@ class DeprecatedCoreExpressionValidator extends AbstractMavenPluginParametersVal DEPRECATED_CORE_PARAMETERS = deprecatedCoreParameters; } +@Inject +DeprecatedCoreExpressionValidator(PluginValidationManager pluginValidationManager) { +super(pluginValidationManager); +} + @Override protected String getParameterLogReason(Parameter parameter) { -return "is deprecated core expression; " + DEPRECATED_CORE_PARAMETERS.get(parameter.getDefaultValue()); +return "uses deprecated parameter expression; " + DEPRECATED_CORE_PARAMETERS.get(parameter.getDefaultValue()); Review Comment: ```suggestion return "uses deprecated parameter expression '" + parameter.getDefaultValue() + "': " DEPRECATED_CORE_PARAMETERS.get(parameter.getDefaultValue()); ``` > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=1771#comment-1771 ] ASF GitHub Bot commented on MNG-7754: - kwin commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1163313730 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DeprecatedCoreExpressionValidator.java: ## @@ -49,21 +52,32 @@ class DeprecatedCoreExpressionValidator extends AbstractMavenPluginParametersVal DEPRECATED_CORE_PARAMETERS = deprecatedCoreParameters; } +@Inject +DeprecatedCoreExpressionValidator(PluginValidationManager pluginValidationManager) { +super(pluginValidationManager); +} + @Override protected String getParameterLogReason(Parameter parameter) { -return "is deprecated core expression; " + DEPRECATED_CORE_PARAMETERS.get(parameter.getDefaultValue()); +return "uses deprecated parameter expression; " + DEPRECATED_CORE_PARAMETERS.get(parameter.getDefaultValue()); Review Comment: ```suggestion return "uses deprecated parameter expression '" + parameter.getDefaultValue() + "': " + DEPRECATED_CORE_PARAMETERS.get(parameter.getDefaultValue()); ``` > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708971#comment-17708971 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497702853 > > Lifecycle binding? > > Huh? for `help:help` which lifecycle you mean specifically? Also, for `clean` lifecycle, where is `site`? https://github.com/apache/maven/blob/maven-3.9.x/maven-core/src/main/resources/META-INF/plexus/components.xml#L67 > > BTW, the message means site plugin is ~LOADED up~ RESOLVED. Why? Eager plugin scanning in core?`Remove maven-site-plugin from local repo and try again. This might prove my theory. > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708966#comment-17708966 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497695403 > Lifecycle binding? Huh? for `help:help` which lifecycle you mean specifically? Also, for `clean` lifecycle, where is `site`? https://github.com/apache/maven/blob/maven-3.9.x/maven-core/src/main/resources/META-INF/plexus/components.xml#L67 > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708965#comment-17708965 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497693342 > Interesting, invoked `mvn help:help` and `mvn clean` (was just wondering what happens), and BOTH produce SAME output: > > ``` > [WARNING] > [WARNING] Plugin validation issues were detected in 1 plugin(s) > [WARNING] > [WARNING] Plugin org.apache.maven.plugins:maven-site-plugin:3.12.1 > [WARNING] Plugin issue(s): > [WARNING]* Plugin depends on the deprecated Maven 2.x compatibility layer, which may not be supported in Maven 4.x > [WARNING] > [WARNING] > [WARNING] To fix these issues, please upgrade above listed plugins, or, notify their maintainers about reported issues. > [WARNING] > [WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [DISABLED, ENABLED, VERBOSE] > [WARNING] > ➜ > ``` > > How does site plugin come in picture for ANY of these? Lifecycle binding? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708963#comment-17708963 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497691993 Interesting, invoked `mvn help:help` and `mvn clean` (was just wondering what happens), and BOTH produce SAME output: ``` [WARNING] [WARNING] Plugin validation issues were detected in 1 plugin(s) [WARNING] [WARNING] Plugin org.apache.maven.plugins:maven-site-plugin:3.12.1 [WARNING] Plugin issue(s): [WARNING]* Plugin depends on the deprecated Maven 2.x compatibility layer, which may not be supported in Maven 4.x [WARNING] [WARNING] [WARNING] To fix these issues, please upgrade above listed plugins, or, notify their maintainers about reported issues. [WARNING] [WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [DISABLED, ENABLED, VERBOSE] [WARNING] ➜ ``` How does site plugin come in picture for ANY of these? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708962#comment-17708962 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158686093 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -0,0 +1,270 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.internal; + +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.File; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.maven.AbstractMavenLifecycleParticipant; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.InputLocation; +import org.apache.maven.plugin.PluginValidationManager; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.project.MavenProject; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Singleton +@Named +public final class DefaultPluginValidationManager extends AbstractMavenLifecycleParticipant +implements PluginValidationManager { + +private static final String ISSUES_KEY = DefaultPluginValidationManager.class.getName() + ".issues"; + +private static final String MAVEN_PLUGIN_VALIDATION_KEY = "maven.plugin.validation"; + +private enum ValidationLevel { +DISABLED, +ENABLED, +VERBOSE +} + +private final Logger logger = LoggerFactory.getLogger(getClass()); + +@Override +public void afterSessionEnd(MavenSession session) { +reportSessionCollectedValidationIssues(session); +} + +private ValidationLevel validationLevel(RepositorySystemSession session) { +String level = ConfigUtils.getString(session, null, MAVEN_PLUGIN_VALIDATION_KEY); +if (level == null || level.isEmpty()) { +return ValidationLevel.ENABLED; +} +try { +return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); +} catch (IllegalArgumentException e) { +logger.warn( +"Invalid value specified for property {}: '{}'. Supported values are (case insensitive): {}", +MAVEN_PLUGIN_VALIDATION_KEY, +level, +Arrays.toString(ValidationLevel.values())); +return ValidationLevel.ENABLED; +} +} + +private String pluginKey(String groupId, String artifactId, String version) { +return groupId + ":" + artifactId + ":" + version; +} + +private String pluginKey(MojoDescriptor mojoDescriptor) { +PluginDescriptor pd = mojoDescriptor.getPluginDescriptor(); +return pluginKey(pd.getGroupId(), pd.getArtifactId(), pd.getVersion()); +} + +private String pluginKey(Artifact pluginArtifact) { +return pluginKey(pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion()); +} + +@Override +public void reportPluginValidationIssue(RepositorySystemSession session, Artifact pluginArtifact, String issue) { +String pluginKey = pluginKey(pluginArtifact); +PluginValidationIssues pluginIssues = +pluginIssues(session).computeIfAbsent(pluginKey, k -> new PluginValidationIssues()); +pluginIssues.reportPluginIssue(null, null, issue); +} + +@Override +public void reportPluginValidationIssue(MavenSession mavenSession, MojoDescriptor mojoDescriptor, String issue) { +String pluginKey = pluginKey(mojoDescriptor); +PluginValidationIssues pluginIssues = pluginIssues(mavenSession.getRepositorySession()) +.computeIfAbsent(pluginKey, k -> new PluginValidatio
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708956#comment-17708956 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497678169 Agreed, and removed > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708950#comment-17708950 ] ASF GitHub Bot commented on MNG-7754: - gnodet commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497656227 > Updated gist once more: since last, removed "from" repeated string, only path alone is in braces. If within TLP, is relative, otherwise is abs (ie. from local repo). I wonder if the `class: ` should be removed too... Not sure it bring much. > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708946#comment-17708946 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497644684 Updated gist once more: since last, removed "from" repeated string, only path alone is in braces. If from TLP, is relative, otherwise is abs (ie. from local repo). > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708944#comment-17708944 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497626742 Updated gist with new output. Removed `prj.name` as well to consistently use `g:a:v` (whether in build module or external artifact), and this also smooth out the output. > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708933#comment-17708933 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497591415 > The improvement is already in, in the "Used in module(s)" section, see https://gist.github.com/cstamas/b62fdcd53eaf316123cf183f5a24e6a5#file-gistfile1-txt-L39 > > But here I have no idea how to reformat location... any example? Right, but not here: https://gist.github.com/cstamas/b62fdcd53eaf316123cf183f5a24e6a5#file-gistfile1-txt-L71-L75 > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708932#comment-17708932 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497588608 The improvement is already in, in the "Used in module(s)" section, see https://gist.github.com/cstamas/b62fdcd53eaf316123cf183f5a24e6a5#file-gistfile1-txt-L39 But here I have no idea how to reformat location... any example? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708914#comment-17708914 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497521642 > What about: > > ``` > [WARNING]* org.apache.maven:maven-settings-builder:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-settings-builder/pom.xml, line 70, column 15 > [WARNING]* org.apache.maven:maven-resolver-provider:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-resolver-provider/pom.xml, line 131, column 15 > [WARNING]* org.apache.maven:maven-core:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-core/pom.xml, line 192, column 15 > ``` this is much better, we can leverage an improvement (https://github.com/apache/maven/pull/756) from @hboutemy recently: > [WARNING]* org.apache.maven:maven-core:3.9.2-SNAPSHOT from /home/cstamas/Worx/apache-maven/maven/maven-core/pom.xml, line 192, column 15 > [WARNING]* org.apache.maven:maven-core:3.9.2-SNAPSHOT from maven-core/pom.xml, line 192, column 15 which might even shorten the output. The rest is from `org.apache.maven.building.DefaultProblem.getLocation()` > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708903#comment-17708903 ] ASF GitHub Bot commented on MNG-7754: - gnodet commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497496068 What about: ``` [WARNING]* org.apache.maven:maven-settings-builder:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-settings-builder/pom.xml, line 70, column 15 [WARNING]* org.apache.maven:maven-resolver-provider:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-resolver-provider/pom.xml, line 131, column 15 [WARNING]* org.apache.maven:maven-core:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-core/pom.xml, line 192, column 15 ``` > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708884#comment-17708884 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497456238 The point to POM sources: 70 : 15, org.apache.maven:maven-settings-builder:3.9.2-SNAPSHOT -> https://github.com/apache/maven/blob/maven-3.9.x/maven-settings-builder/pom.xml#L70 131 : 15, org.apache.maven:maven-resolver-provider:3.9.2-SNAPSHOT -> https://github.com/apache/maven/blob/maven-3.9.x/maven-resolver-provider/pom.xml#L131 192 : 15, org.apache.maven:maven-core:3.9.2-SNAPSHOT -> https://github.com/apache/maven/blob/maven-3.9.x/maven-core/pom.xml#L192 > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708881#comment-17708881 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497451764 > > I still have a problem to read that this output: > > Don't bother, it comes only when you set 'verbose' but that means you have bigger problems as well 😆 > > Seriously: any proposal how to improve it? I don't even know what those numbers mean, can you point me to the source where it comes from? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708879#comment-17708879 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497450913 > I still have a problem to read that this output: Don't bother, it comes only when you set 'verbose' but that means you have bigger problems as well :laughing: Seriously: any proposal how to improve it? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708874#comment-17708874 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497441878 I still have a problem to read that this output: > Looking at the output: > > ``` > [WARNING]* 70 : 15, org.apache.maven:maven-settings-builder:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-settings-builder/pom.xml > [WARNING]* 131 : 15, org.apache.maven:maven-resolver-provider:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-resolver-provider/pom.xml > [WARNING]* 192 : 15, org.apache.maven:maven-core:3.9.2-SNAPSHOT /home/cstamas/Worx/apache-maven/maven/maven-core/pom.xml > ``` > > I don't understand how to read those numbers and to what they relate. > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708873#comment-17708873 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158482777 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -70,8 +72,12 @@ private ValidationLevel validationLevel(RepositorySystemSession session) { try { return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { -throw new IllegalArgumentException( -"Invalid value specified for property " + MAVEN_PLUGIN_VALIDATION_KEY + ": '" + level + "'", e); +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", Review Comment: OK. let's leave the change. I am fine with the concensus! > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708870#comment-17708870 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158472743 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -70,8 +72,12 @@ private ValidationLevel validationLevel(RepositorySystemSession session) { try { return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { -throw new IllegalArgumentException( -"Invalid value specified for property " + MAVEN_PLUGIN_VALIDATION_KEY + ": '" + level + "'", e); +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", Review Comment: Same here: changed to quoted user supplied value (that really can be anything) > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708867#comment-17708867 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158467904 ## maven-core/src/main/java/org/apache/maven/plugin/internal/AbstractMavenPluginParametersValidator.java: ## @@ -94,19 +98,19 @@ protected boolean isIgnoredProperty(String strValue) { protected abstract String getParameterLogReason(Parameter parameter); -protected void logParameter(Parameter parameter) { -MessageBuilder messageBuilder = MessageUtils.buffer() -.warning("Parameter '") -.warning(parameter.getName()) -.warning('\''); +protected String formatParameter(Parameter parameter) { +StringBuilder messageBuilder = new StringBuilder() Review Comment: oh, missed that! > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708866#comment-17708866 ] ASF GitHub Bot commented on MNG-7754: - gnodet commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158466651 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -70,8 +72,12 @@ private ValidationLevel validationLevel(RepositorySystemSession session) { try { return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { -throw new IllegalArgumentException( -"Invalid value specified for property " + MAVEN_PLUGIN_VALIDATION_KEY + ": '" + level + "'", e); +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", Review Comment: Ok, that was the exact opposite before this PR. I would assume quotes are more needed for a user supplied value (which could be empty, with spaces, etc...) rather than for the property name which we do control. > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Assignee: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708863#comment-17708863 ] ASF GitHub Bot commented on MNG-7754: - gnodet commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158464775 ## maven-core/src/main/java/org/apache/maven/plugin/internal/AbstractMavenPluginParametersValidator.java: ## @@ -94,19 +98,19 @@ protected boolean isIgnoredProperty(String strValue) { protected abstract String getParameterLogReason(Parameter parameter); -protected void logParameter(Parameter parameter) { -MessageBuilder messageBuilder = MessageUtils.buffer() -.warning("Parameter '") -.warning(parameter.getName()) -.warning('\''); +protected String formatParameter(Parameter parameter) { +StringBuilder messageBuilder = new StringBuilder() Review Comment: No, the idea is to change rename the variable to `stringBuilder` ``` StringBuilder stringBuilder = new StringBuilder() ``` > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708858#comment-17708858 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158457283 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -70,8 +72,12 @@ private ValidationLevel validationLevel(RepositorySystemSession session) { try { return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { -throw new IllegalArgumentException( -"Invalid value specified for property " + MAVEN_PLUGIN_VALIDATION_KEY + ": '" + level + "'", e); +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", Review Comment: No, I expect the statement to be: `"Invalid value specified for property '{}': {}. Supported values are (case insensitive): {}"` > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708849#comment-17708849 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158445819 ## maven-core/src/main/java/org/apache/maven/plugin/internal/AbstractMavenPluginParametersValidator.java: ## @@ -94,19 +98,19 @@ protected boolean isIgnoredProperty(String strValue) { protected abstract String getParameterLogReason(Parameter parameter); -protected void logParameter(Parameter parameter) { -MessageBuilder messageBuilder = MessageUtils.buffer() -.warning("Parameter '") -.warning(parameter.getName()) -.warning('\''); +protected String formatParameter(Parameter parameter) { +StringBuilder messageBuilder = new StringBuilder() Review Comment: Is this a question? If so, is it just a rhetorical question? :smile: > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708829#comment-17708829 ] ASF GitHub Bot commented on MNG-7754: - gnodet commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158396413 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -70,8 +72,12 @@ private ValidationLevel validationLevel(RepositorySystemSession session) { try { return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { -throw new IllegalArgumentException( -"Invalid value specified for property " + MAVEN_PLUGIN_VALIDATION_KEY + ": '" + level + "'", e); +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", Review Comment: You meant _before_ the column ? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708753#comment-17708753 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158205345 ## maven-core/src/main/java/org/apache/maven/plugin/internal/MavenMixedDependenciesValidator.java: ## @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.internal; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.PluginValidationManager; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.codehaus.plexus.component.repository.ComponentDependency; + +/** + * Detects mixed Maven versions in plugins. + * + * @since 3.9.2 + */ +@Singleton +@Named +class MavenMixedDependenciesValidator extends AbstractMavenPluginDependenciesValidator { + +@Inject +MavenMixedDependenciesValidator(PluginValidationManager pluginValidationManager) { +super(pluginValidationManager); +} + +@Override +protected void doValidate(MavenSession mavenSession, MojoDescriptor mojoDescriptor) { +Set mavenVersions = mojoDescriptor.getPluginDescriptor().getDependencies().stream() +.filter(d -> "org.apache.maven".equals(d.getGroupId())) +.filter(d -> !"maven-archiver".equals(d.getArtifactId())) +.map(ComponentDependency::getVersion) +.collect(Collectors.toSet()); + +if (mavenVersions.size() > 1) { +pluginValidationManager.reportPluginValidationIssue( +mavenSession, mojoDescriptor, "Plugin mixes multiple Maven versions: " + mavenVersions); +} Review Comment: Now I see, from the message it is hard to derive that. > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708750#comment-17708750 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158199434 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -70,8 +72,12 @@ private ValidationLevel validationLevel(RepositorySystemSession session) { try { return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { -throw new IllegalArgumentException( -"Invalid value specified for property " + MAVEN_PLUGIN_VALIDATION_KEY + ": '" + level + "'", e); +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", Review Comment: The single quotes aren't necessary after then colon. That's the purpose of the colon. ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -169,10 +169,10 @@ public void reportSessionCollectedValidationIssues(MavenSession mavenSession) { } logger.warn(""); logger.warn( -"To fix these issues, please upgrade listed plugins, or notify their maintainers about these issues."); +"To fix these issues, please upgrade above listed plugins, or, notify their maintainers about reported issues."); logger.warn(""); logger.warn( -"To get more or less details, use 'maven.plugin.validation' user property with one of the values: 'disabled', 'verbose' or (implied) 'default'"); +"For more or less details in this report, use 'maven.plugin.validation' user property with one of the values: 'disabled', 'verbose' or (implied) 'default'"); Review Comment: description after value: ...'verbose' or 'default' (implied)" > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708747#comment-17708747 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158180149 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -0,0 +1,248 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.internal; + +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.File; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.maven.AbstractMavenLifecycleParticipant; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.InputLocation; +import org.apache.maven.plugin.PluginValidationManager; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.project.MavenProject; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Singleton +@Named +public final class DefaultPluginValidationManager extends AbstractMavenLifecycleParticipant +implements PluginValidationManager { + +private static final String ISSUES_KEY = DefaultPluginValidationManager.class.getName() + ".issues"; + +private static final String MAVEN_PLUGIN_VALIDATION_KEY = "maven.plugin.validation"; + +private enum ValidationLevel { +DISABLED, +DEFAULT, +VERBOSE +} + +private final Logger logger = LoggerFactory.getLogger(getClass()); + +@Override +public void afterSessionEnd(MavenSession session) { +reportSessionCollectedValidationIssues(session); +} + +private ValidationLevel validationLevel(RepositorySystemSession session) { +String level = ConfigUtils.getString(session, null, MAVEN_PLUGIN_VALIDATION_KEY); +if (level == null || level.isEmpty()) { +return ValidationLevel.DEFAULT; +} +try { +return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); +} catch (IllegalArgumentException e) { +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", +MAVEN_PLUGIN_VALIDATION_KEY, +level, +Arrays.toString(ValidationLevel.values())); +return ValidationLevel.DEFAULT; +} +} + +private String pluginKey(String groupId, String artifactId, String version) { +return groupId + ":" + artifactId + ":" + version; +} + +private String pluginKey(MojoDescriptor mojoDescriptor) { +PluginDescriptor pd = mojoDescriptor.getPluginDescriptor(); +return pluginKey(pd.getGroupId(), pd.getArtifactId(), pd.getVersion()); +} + +private String pluginKey(Artifact pluginArtifact) { +return pluginKey(pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion()); +} + +@Override +public void reportPluginValidationIssue(RepositorySystemSession session, Artifact pluginArtifact, String issue) { +String pluginKey = pluginKey(pluginArtifact); +PluginValidationIssues pluginIssues = +pluginIssues(session).computeIfAbsent(pluginKey, k -> new PluginValidationIssues()); +pluginIssues.reportPluginIssue(null, null, issue); +} + +@Override +public void reportPluginValidationIssue(MavenSession mavenSession, MojoDescriptor mojoDescriptor, String issue) { +String pluginKey = pluginKey(mojoDescriptor); +PluginValidationIssues pluginIssues = pluginIssues(mavenSession.getRepositorySession()) +.computeIfAbsent(pluginKey, k -> new PluginValidatio
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708746#comment-17708746 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1497097725 Can someone look at ITs https://github.com/apache/maven-integration-testing/pull/256 to have them pass finally? > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708745#comment-17708745 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158178091 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -0,0 +1,248 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.internal; + +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.File; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.maven.AbstractMavenLifecycleParticipant; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.InputLocation; +import org.apache.maven.plugin.PluginValidationManager; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.project.MavenProject; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Singleton +@Named +public final class DefaultPluginValidationManager extends AbstractMavenLifecycleParticipant +implements PluginValidationManager { + +private static final String ISSUES_KEY = DefaultPluginValidationManager.class.getName() + ".issues"; + +private static final String MAVEN_PLUGIN_VALIDATION_KEY = "maven.plugin.validation"; + +private enum ValidationLevel { +DISABLED, +DEFAULT, +VERBOSE +} + +private final Logger logger = LoggerFactory.getLogger(getClass()); + +@Override +public void afterSessionEnd(MavenSession session) { +reportSessionCollectedValidationIssues(session); +} + +private ValidationLevel validationLevel(RepositorySystemSession session) { +String level = ConfigUtils.getString(session, null, MAVEN_PLUGIN_VALIDATION_KEY); +if (level == null || level.isEmpty()) { +return ValidationLevel.DEFAULT; +} +try { +return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); +} catch (IllegalArgumentException e) { +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", +MAVEN_PLUGIN_VALIDATION_KEY, +level, +Arrays.toString(ValidationLevel.values())); +return ValidationLevel.DEFAULT; +} +} + +private String pluginKey(String groupId, String artifactId, String version) { +return groupId + ":" + artifactId + ":" + version; +} + +private String pluginKey(MojoDescriptor mojoDescriptor) { +PluginDescriptor pd = mojoDescriptor.getPluginDescriptor(); +return pluginKey(pd.getGroupId(), pd.getArtifactId(), pd.getVersion()); +} + +private String pluginKey(Artifact pluginArtifact) { +return pluginKey(pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion()); +} + +@Override +public void reportPluginValidationIssue(RepositorySystemSession session, Artifact pluginArtifact, String issue) { +String pluginKey = pluginKey(pluginArtifact); +PluginValidationIssues pluginIssues = +pluginIssues(session).computeIfAbsent(pluginKey, k -> new PluginValidationIssues()); +pluginIssues.reportPluginIssue(null, null, issue); +} + +@Override +public void reportPluginValidationIssue(MavenSession mavenSession, MojoDescriptor mojoDescriptor, String issue) { +String pluginKey = pluginKey(mojoDescriptor); +PluginValidationIssues pluginIssues = pluginIssues(mavenSession.getRepositorySession()) +.computeIfAbsent(pluginKey, k -> new PluginValidatio
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708742#comment-17708742 ] ASF GitHub Bot commented on MNG-7754: - slawekjaranowski commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158173224 ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java: ## @@ -0,0 +1,248 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.internal; + +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.File; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.maven.AbstractMavenLifecycleParticipant; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.InputLocation; +import org.apache.maven.plugin.PluginValidationManager; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.project.MavenProject; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.util.ConfigUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Singleton +@Named +public final class DefaultPluginValidationManager extends AbstractMavenLifecycleParticipant +implements PluginValidationManager { + +private static final String ISSUES_KEY = DefaultPluginValidationManager.class.getName() + ".issues"; + +private static final String MAVEN_PLUGIN_VALIDATION_KEY = "maven.plugin.validation"; + +private enum ValidationLevel { +DISABLED, +DEFAULT, +VERBOSE +} + +private final Logger logger = LoggerFactory.getLogger(getClass()); + +@Override +public void afterSessionEnd(MavenSession session) { +reportSessionCollectedValidationIssues(session); +} + +private ValidationLevel validationLevel(RepositorySystemSession session) { +String level = ConfigUtils.getString(session, null, MAVEN_PLUGIN_VALIDATION_KEY); +if (level == null || level.isEmpty()) { +return ValidationLevel.DEFAULT; +} +try { +return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH)); +} catch (IllegalArgumentException e) { +logger.warn( +"Invalid value specified for property '{}': '{}'. Supported values are (case insensitive): {}", +MAVEN_PLUGIN_VALIDATION_KEY, +level, +Arrays.toString(ValidationLevel.values())); +return ValidationLevel.DEFAULT; +} +} + +private String pluginKey(String groupId, String artifactId, String version) { +return groupId + ":" + artifactId + ":" + version; +} + +private String pluginKey(MojoDescriptor mojoDescriptor) { +PluginDescriptor pd = mojoDescriptor.getPluginDescriptor(); +return pluginKey(pd.getGroupId(), pd.getArtifactId(), pd.getVersion()); +} + +private String pluginKey(Artifact pluginArtifact) { +return pluginKey(pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion()); +} + +@Override +public void reportPluginValidationIssue(RepositorySystemSession session, Artifact pluginArtifact, String issue) { +String pluginKey = pluginKey(pluginArtifact); +PluginValidationIssues pluginIssues = +pluginIssues(session).computeIfAbsent(pluginKey, k -> new PluginValidationIssues()); +pluginIssues.reportPluginIssue(null, null, issue); +} + +@Override +public void reportPluginValidationIssue(MavenSession mavenSession, MojoDescriptor mojoDescriptor, String issue) { +String pluginKey = pluginKey(mojoDescriptor); +PluginValidationIssues pluginIssues = pluginIssues(mavenSession.getRepositorySession()) +.computeIfAbsent(pluginKey, k -> new Plugin
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708696#comment-17708696 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1496987729 Applied PR comments and proposals > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708682#comment-17708682 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1158059101 ## maven-core/src/main/java/org/apache/maven/plugin/internal/MavenMixedDependenciesValidator.java: ## @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.internal; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.PluginValidationManager; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.codehaus.plexus.component.repository.ComponentDependency; + +/** + * Detects mixed Maven versions in plugins. + * + * @since 3.9.2 + */ +@Singleton +@Named +class MavenMixedDependenciesValidator extends AbstractMavenPluginDependenciesValidator { + +@Inject +MavenMixedDependenciesValidator(PluginValidationManager pluginValidationManager) { +super(pluginValidationManager); +} + +@Override +protected void doValidate(MavenSession mavenSession, MojoDescriptor mojoDescriptor) { +Set mavenVersions = mojoDescriptor.getPluginDescriptor().getDependencies().stream() +.filter(d -> "org.apache.maven".equals(d.getGroupId())) +.filter(d -> !"maven-archiver".equals(d.getArtifactId())) +.map(ComponentDependency::getVersion) +.collect(Collectors.toSet()); + +if (mavenVersions.size() > 1) { +pluginValidationManager.reportPluginValidationIssue( +mavenSession, mojoDescriptor, "Plugin mixes multiple Maven versions: " + mavenVersions); +} Review Comment: Unsure how to put it in words, but the point is that "among plugin dependencies there are maven artifacts that has different versions" > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708564#comment-17708564 ] ASF GitHub Bot commented on MNG-7754: - slawekjaranowski commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1157704267 ## maven-core/src/main/java/org/apache/maven/plugin/internal/Maven2DependenciesValidator.java: ## @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.internal; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.PluginValidationManager; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.codehaus.plexus.component.repository.ComponentDependency; + +/** + * Detects Maven2 plugins. + * + * @since 3.9.2 + */ +@Singleton +@Named +class Maven2DependenciesValidator extends AbstractMavenPluginDependenciesValidator { + +@Inject +Maven2DependenciesValidator(PluginValidationManager pluginValidationManager) { +super(pluginValidationManager); +} + +@Override +protected void doValidate(MavenSession mavenSession, MojoDescriptor mojoDescriptor) { +Set maven2Versions = mojoDescriptor.getPluginDescriptor().getDependencies().stream() +.filter(d -> "org.apache.maven".equals(d.getGroupId())) +.filter(d -> !"maven-archiver".equals(d.getArtifactId())) Review Comment: In plugin-tools we have: ```java private List expectedProvidedScopeExclusions = Arrays.asList( "org.apache.maven:maven-archiver", "org.apache.maven:maven-jxr", "org.apache.maven:plexus-utils"); ``` ## maven-core/src/main/java/org/apache/maven/plugin/internal/AbstractMavenPluginParametersValidator.java: ## @@ -94,19 +98,19 @@ protected boolean isIgnoredProperty(String strValue) { protected abstract String getParameterLogReason(Parameter parameter); -protected void logParameter(Parameter parameter) { -MessageBuilder messageBuilder = MessageUtils.buffer() -.warning("Parameter '") -.warning(parameter.getName()) -.warning('\''); +protected String formatParameter(Parameter parameter) { +StringBuilder messageBuilder = new StringBuilder() Review Comment: now is stringBuilder not messageBuilder ## maven-core/src/main/java/org/apache/maven/plugin/internal/AbstractMavenPluginParametersValidator.java: ## @@ -94,19 +98,19 @@ protected boolean isIgnoredProperty(String strValue) { protected abstract String getParameterLogReason(Parameter parameter); -protected void logParameter(Parameter parameter) { -MessageBuilder messageBuilder = MessageUtils.buffer() -.warning("Parameter '") -.warning(parameter.getName()) -.warning('\''); +protected String formatParameter(Parameter parameter) { Review Comment: Everything will be logged at the end, so probable reason of remove formatting here ## maven-core/src/main/java/org/apache/maven/plugin/internal/MavenMixedDependenciesValidator.java: ## @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limit
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708541#comment-17708541 ] ASF GitHub Bot commented on MNG-7754: - michael-o commented on code in PR #1079: URL: https://github.com/apache/maven/pull/1079#discussion_r1157634508 ## maven-core/src/main/java/org/apache/maven/plugin/internal/AbstractMavenPluginDependenciesValidator.java: ## @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.internal; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.PluginValidationManager; +import org.apache.maven.plugin.descriptor.MojoDescriptor; + +import static java.util.Objects.requireNonNull; + +/** + * Service responsible for validating plugin dependencies. + * + * @since 3.9.2 + */ +abstract class AbstractMavenPluginDependenciesValidator implements MavenPluginDependenciesValidator { + +protected final PluginValidationManager pluginValidationManager; + +protected AbstractMavenPluginDependenciesValidator(PluginValidationManager pluginValidationManager) { +this.pluginValidationManager = requireNonNull(pluginValidationManager); +} + +@Override +public void validate(MavenSession mavenSession, MojoDescriptor mojoDescriptor) { +if (mojoDescriptor.getPluginDescriptor() != null Review Comment: Can they be null?! Weird ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java: ## @@ -103,6 +107,19 @@ public Artifact resolve(Plugin plugin, List repositories, Repo request.setTrace(trace); ArtifactDescriptorResult result = repoSystem.readArtifactDescriptor(pluginSession, request); +if (result.getDependencies() != null) { +for (org.eclipse.aether.graph.Dependency dependency : result.getDependencies()) { +if ("org.apache.maven".equals(dependency.getArtifact().getGroupId()) +&& "maven-compat".equals(dependency.getArtifact().getArtifactId()) +&& !JavaScopes.TEST.equals(dependency.getScope())) { Review Comment: Does provided make sense? ## maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java: ## @@ -540,6 +548,18 @@ public T getConfiguredMojo(Class mojoInterface, MavenSession session, Moj ((Mojo) mojo).setLog(new DefaultLog(mojoLogger)); } +if (mojo instanceof Contextualizable) { +pluginValidationManager.reportPluginMojoValidationIssue( +session, +mojoDescriptor, +mojo.getClass(), +"Implements `Contextualizable` interface from Plexus Container, that is EOL."); Review Comment: ...Container, which is EOL. ## maven-core/src/main/java/org/apache/maven/plugin/internal/AbstractMavenPluginParametersValidator.java: ## @@ -94,19 +98,19 @@ protected boolean isIgnoredProperty(String strValue) { protected abstract String getParameterLogReason(Parameter parameter); -protected void logParameter(Parameter parameter) { -MessageBuilder messageBuilder = MessageUtils.buffer() -.warning("Parameter '") -.warning(parameter.getName()) -.warning('\''); +protected String formatParameter(Parameter parameter) { Review Comment: Attention: The `MessageBuilder` is here on purpose to highlight stuff. Why is it gone? ## maven-core/src/main/java/org/apache/maven/plugin/internal/DeprecatedCoreExpressionValidator.java: ## @@ -40,7 +43,7 @@ class DeprecatedCoreExpressionValidator extends AbstractMavenPluginParametersVal private static final HashMap DEPRECATED_CORE_PARAMETERS; private static final String ARTIFACT_REPOSITORY_REASON = -"Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead
[jira] [Commented] (MNG-7754) Improvement and extension of plugin validation
[ https://issues.apache.org/jira/browse/MNG-7754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17708423#comment-17708423 ] ASF GitHub Bot commented on MNG-7754: - cstamas commented on PR #1079: URL: https://github.com/apache/maven/pull/1079#issuecomment-1495974782 IT fix https://github.com/apache/maven-integration-testing/pull/256 Tested with 3.9.1 and this PR, both pass OK > Improvement and extension of plugin validation > -- > > Key: MNG-7754 > URL: https://issues.apache.org/jira/browse/MNG-7754 > Project: Maven > Issue Type: Task > Components: Core >Affects Versions: 3.9.1 >Reporter: Tamas Cservenak >Priority: Major > Fix For: 3.9.2, 4.0.0-alpha-6, 4.0.0 > > > Some users when see following warning: > {noformat} > [INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ maven > --- > [WARNING] Parameter 'localRepository' is deprecated core expression; Avoid > use of ArtifactRepository type. If you need access to local repository, > switch to '${repositorySystemSession}' expression and get LRM from it > instead. {noformat} > on their console, immediately grep their {{$HOME}} to find out that they DO > HAVE afore mentioned string present in their {{{}settings.xml{}}}, and then > scratch their head how to get rid of it. > Hence, we should improve error message – at least add some clue that message > targets given Mojo developers (as message appears immediately under Mojo > execution log message) and not users. Best users could do is nag Mojo > developers, and not us, to make message disappear. > Improvements: > * report at end, instead multiple times same warning (for reactor builds) > * possibility to suppress validation > * new check: maven-compat, maven2, p-c-d, mixed maven verions,, wrong scopes > (similar as m-p-p does on build time) -- This message was sent by Atlassian Jira (v8.20.10#820010)