mirror of https://github.com/apache/maven.git
[MNG-7823] Improve plugin validation level parsing (#1182)
Changes: * always parse it at session start * hence, will WARN if needed there as well, and will warn once * do not re-parse and possibly warn always, reuse parsed enum --- https://issues.apache.org/jira/browse/MNG-7823
This commit is contained in:
parent
c9ba8bc4bf
commit
764a9ca0be
|
@ -83,13 +83,22 @@ public final class DefaultPluginValidationManager extends AbstractEventSpy imple
|
|||
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(repositorySystemSession); // this will parse and store it in session.data
|
||||
} else if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
|
||||
reportSessionCollectedValidationIssues(executionEvent.getSession());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ValidationReportLevel validationReportLevel(RepositorySystemSession session) {
|
||||
return (ValidationReportLevel) session.getData()
|
||||
.computeIfAbsent(ValidationReportLevel.class, () -> parseValidationReportLevel(session));
|
||||
}
|
||||
|
||||
private ValidationReportLevel parseValidationReportLevel(RepositorySystemSession session) {
|
||||
String level = ConfigUtils.getString(session, null, MAVEN_PLUGIN_VALIDATION_KEY);
|
||||
if (level == null || level.isEmpty()) {
|
||||
return DEFAULT_VALIDATION_LEVEL;
|
||||
|
|
Loading…
Reference in New Issue