Add validatePomFiles Task
@@ -2,6 +2,7 @@ package io.freefair.gradle.plugins.maven.central;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
+import org.gradle.api.Task;
import org.gradle.api.publish.maven.tasks.GenerateMavenPom;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.language.base.plugins.LifecycleBasePlugin;
@@ -13,6 +14,10 @@ public class ValidatePomsPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
+ TaskProvider<Task> validateAll = project.getTasks().register("validatePomFiles", t -> {
+ t.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
+ });
+
project.getTasks().withType(GenerateMavenPom.class, generateMavenPom -> {
String checkTaskName;
@@ -24,7 +29,15 @@ public class ValidatePomsPlugin implements Plugin<Project> {
checkTaskName = "validate" + generateMavenPom.getName();
}
- TaskProvider<ValidateMavenPom> validateMavenPom = project.getTasks().register(checkTaskName, ValidateMavenPom.class);
+ TaskProvider<ValidateMavenPom> validateMavenPom = project.getTasks().register(checkTaskName, ValidateMavenPom.class, t -> {
+ t.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
+ String description = generateMavenPom.getDescription();
+ if (description != null) {
+ t.setDescription(description.replace("Generates", "Validates"));
+ }
+ });
+
+ validateAll.configure(all -> all.dependsOn(validateMavenPom));
project.getPlugins().withType(LifecycleBasePlugin.class, lbp -> {
project.getTasks().named(LifecycleBasePlugin.CHECK_TASK_NAME).configure(check -> {
