Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-7767] Tone down plugin validator #1092

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public final class DefaultPluginValidationManager extends AbstractMavenLifecycle
private static final String MAVEN_PLUGIN_VALIDATION_KEY = "maven.plugin.validation";

private enum ValidationLevel {
DISABLED,
ENABLED,
BRIEF,
DEFAULT,
VERBOSE
}

Expand All @@ -67,7 +67,7 @@ public void afterSessionEnd(MavenSession session) {
private ValidationLevel validationLevel(RepositorySystemSession session) {
String level = ConfigUtils.getString(session, null, MAVEN_PLUGIN_VALIDATION_KEY);
if (level == null || level.isEmpty()) {
return ValidationLevel.ENABLED;
return ValidationLevel.DEFAULT;
}
try {
return ValidationLevel.valueOf(level.toUpperCase(Locale.ENGLISH));
Expand All @@ -77,7 +77,7 @@ private ValidationLevel validationLevel(RepositorySystemSession session) {
MAVEN_PLUGIN_VALIDATION_KEY,
level,
Arrays.toString(ValidationLevel.values()));
return ValidationLevel.ENABLED;
return ValidationLevel.DEFAULT;
}
}

Expand Down Expand Up @@ -132,46 +132,49 @@ private void reportSessionCollectedValidationIssues(MavenSession mavenSession) {
logger.warn("");
logger.warn("Plugin validation issues were detected in {} plugin(s)", issuesMap.size());
logger.warn("");
if (validationLevel == ValidationLevel.DISABLED || !logger.isWarnEnabled()) {
if (validationLevel == ValidationLevel.BRIEF || !logger.isWarnEnabled()) {
return;
}

for (Map.Entry<String, PluginValidationIssues> entry : issuesMap.entrySet()) {
logger.warn("Plugin {}", entry.getKey());
PluginValidationIssues issues = entry.getValue();
if (validationLevel == ValidationLevel.VERBOSE && !issues.pluginDeclarations.isEmpty()) {
logger.warn(" Declared at location(s):");
for (String pluginDeclaration : issues.pluginDeclarations) {
logger.warn(" * {}", pluginDeclaration);
logger.warn(" * {}", entry.getKey());
if (validationLevel == ValidationLevel.VERBOSE) {
PluginValidationIssues issues = entry.getValue();
if (!issues.pluginDeclarations.isEmpty()) {
logger.warn(" Declared at location(s):");
for (String pluginDeclaration : issues.pluginDeclarations) {
logger.warn(" * {}", pluginDeclaration);
}
}
}
if (validationLevel == ValidationLevel.VERBOSE && !issues.pluginOccurrences.isEmpty()) {
logger.warn(" Used in module(s):");
for (String pluginOccurrence : issues.pluginOccurrences) {
logger.warn(" * {}", pluginOccurrence);
if (!issues.pluginOccurrences.isEmpty()) {
logger.warn(" Used in module(s):");
for (String pluginOccurrence : issues.pluginOccurrences) {
logger.warn(" * {}", pluginOccurrence);
}
}
}
if (!issues.pluginIssues.isEmpty()) {
logger.warn(" Plugin issue(s):");
for (String pluginIssue : issues.pluginIssues) {
logger.warn(" * {}", pluginIssue);
if (!issues.pluginIssues.isEmpty()) {
logger.warn(" Plugin issue(s):");
for (String pluginIssue : issues.pluginIssues) {
logger.warn(" * {}", pluginIssue);
}
}
}
if (!issues.mojoIssues.isEmpty()) {
logger.warn(" Mojo issue(s):");
for (String mojoInfo : issues.mojoIssues.keySet()) {
logger.warn(" * Mojo {}", mojoInfo);
for (String mojoIssue : issues.mojoIssues.get(mojoInfo)) {
logger.warn(" - {}", mojoIssue);
if (!issues.mojoIssues.isEmpty()) {
logger.warn(" Mojo issue(s):");
for (String mojoInfo : issues.mojoIssues.keySet()) {
logger.warn(" * Mojo {}", mojoInfo);
for (String mojoIssue : issues.mojoIssues.get(mojoInfo)) {
logger.warn(" - {}", mojoIssue);
}
}
}
logger.warn("");
}
logger.warn("");
}
logger.warn("");
logger.warn(
"To fix these issues, please upgrade above listed plugins, or, notify their maintainers about reported issues.");
logger.warn("");
if (validationLevel == ValidationLevel.VERBOSE) {
logger.warn(
"Fix reported issues by adjusting plugin configuration or by upgrading above listed plugins. If no upgrade available, please notify plugin maintainers about reported issues." );
}
logger.warn(
"For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): {}",
Arrays.toString(ValidationLevel.values()));
Expand Down