From f2df54723b9e39259e10684e5bf22347f3f1b732 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Mon, 16 Oct 2023 13:28:47 +0200 Subject: [PATCH] [MNG-7804] Ability to order plugin executions using the priority xml element (#1147) --- api/maven-api-model/src/main/mdo/maven.mdo | 11 ++++++++++- maven-model/pom.xml | 8 +++++++- .../maven/model/v4/MavenModelVersionTest.java | 13 +++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/api/maven-api-model/src/main/mdo/maven.mdo b/api/maven-api-model/src/main/mdo/maven.mdo index 2c24e748e0..cabb49613b 100644 --- a/api/maven-api-model/src/main/mdo/maven.mdo +++ b/api/maven-api-model/src/main/mdo/maven.mdo @@ -2634,7 +2634,7 @@ priority - 4.0.0+ + 4.0.0 int + + priority + 4.1.0+ + int + The priority of this execution compared to other executions which are bound to the same phase. + Executions derived from the default lifecycle have a negative priority by default so that they are executed + before any custom plugin executions. + + goals 4.0.0+ diff --git a/maven-model/pom.xml b/maven-model/pom.xml index 42e759edaf..48e0e7c4ee 100644 --- a/maven-model/pom.xml +++ b/maven-model/pom.xml @@ -90,10 +90,16 @@ under the License. modello-site-docs xdoc - xsd pre-site + + modello-schema + + xsd + + generate-resources + model-v3 diff --git a/maven-model/src/test/java/org/apache/maven/model/v4/MavenModelVersionTest.java b/maven-model/src/test/java/org/apache/maven/model/v4/MavenModelVersionTest.java index ff2abdc981..e65a70ec52 100644 --- a/maven-model/src/test/java/org/apache/maven/model/v4/MavenModelVersionTest.java +++ b/maven-model/src/test/java/org/apache/maven/model/v4/MavenModelVersionTest.java @@ -19,8 +19,12 @@ package org.apache.maven.model.v4; import java.io.InputStream; +import java.util.Collections; +import org.apache.maven.api.model.Build; import org.apache.maven.api.model.Model; +import org.apache.maven.api.model.Plugin; +import org.apache.maven.api.model.PluginExecution; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -59,4 +63,13 @@ class MavenModelVersionTest { Model m = model.withPreserveModelVersion(true); assertEquals("4.1.0", new MavenModelVersion().getModelVersion(m)); } + + @Test + void testV4V4ModelPriority() { + Model m = model.withBuild(Build.newInstance() + .withPlugins(Collections.singleton(Plugin.newInstance() + .withExecutions(Collections.singleton( + PluginExecution.newInstance().withPriority(5)))))); + assertEquals("4.1.0", new MavenModelVersion().getModelVersion(m)); + } }