[
https://issues.apache.org/jira/browse/MNG-7823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736449#comment-17736449
]
ASF GitHub Bot commented on MNG-7823:
-------------------------------------
cstamas commented on code in PR #1182:
URL: https://github.com/apache/maven/pull/1182#discussion_r1239650547
##########
maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java:
##########
@@ -83,13 +83,23 @@ private enum ValidationReportLevel {
public void onEvent(Object event) {
if (event instanceof ExecutionEvent) {
ExecutionEvent executionEvent = (ExecutionEvent) event;
- if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
+ if (executionEvent.getType() ==
ExecutionEvent.Type.SessionStarted) {
+ RepositorySystemSession repositorySystemSession =
+ executionEvent.getSession().getRepositorySession();
+ ValidationReportLevel level =
parseValidationReportLevel(repositorySystemSession);
+
repositorySystemSession.getData().set(MAVEN_PLUGIN_VALIDATION_KEY, level);
+ } else if (executionEvent.getType() ==
ExecutionEvent.Type.SessionEnded) {
reportSessionCollectedValidationIssues(executionEvent.getSession());
}
}
}
private ValidationReportLevel
validationReportLevel(RepositorySystemSession session) {
+ return (ValidationReportLevel) session.getData()
+ .computeIfAbsent(MAVEN_PLUGIN_VALIDATION_KEY, () ->
parseValidationReportLevel(session));
Review Comment:
no, this is session.data while string is in session.configProperties, two
distinct maps
> Make plugin validation level parsing more consistent
> ----------------------------------------------------
>
> Key: MNG-7823
> URL: https://issues.apache.org/jira/browse/MNG-7823
> Project: Maven
> Issue Type: Improvement
> Reporter: Tamas Cservenak
> Priority: Major
> Fix For: 3.9.3, 4.0.0-alpha-6, 4.0.0
>
>
> Currently, the value of {{maven.plugin.validation}} is:
> * parsed each time is needed (from string)
> * warns for bad value lazily (when parsed), this implies WARN is "lazy",
> happens when needed, and can make things "look like" some plugin warns for
> some reason
> * will warn EACH time needed
> Instead:
> * on session start parse it and store it into session.data
> * this means on session start will warn as well, and warn once
> * parsed enum should be reused, instead to repeatedly parse and warn whenever
> level needed
--
This message was sent by Atlassian Jira
(v8.20.10#820010)