[MNG-7804] Ability to order plugin executions using the priority xml element (#1147)

This commit is contained in:
Guillaume Nodet 2023-10-16 13:28:47 +02:00 committed by GitHub
parent bd608d8cc9
commit f2df54723b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 2 deletions

View File

@ -2634,7 +2634,7 @@
</field>
<field xml.transient="true">
<name>priority</name>
<version>4.0.0+</version>
<version>4.0.0</version>
<type>int</type>
<description>
<![CDATA[
@ -2645,6 +2645,15 @@
]]>
</description>
</field>
<field>
<name>priority</name>
<version>4.1.0+</version>
<type>int</type>
<description>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.
</description>
</field>
<field>
<name>goals</name>
<version>4.0.0+</version>

View File

@ -90,10 +90,16 @@ under the License.
<id>modello-site-docs</id>
<goals>
<goal>xdoc</goal>
<goal>xsd</goal>
</goals>
<phase>pre-site</phase>
</execution>
<execution>
<id>modello-schema</id>
<goals>
<goal>xsd</goal>
</goals>
<phase>generate-resources</phase>
</execution>
<execution>
<id>model-v3</id>
<goals>

View File

@ -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 @@ void testV4ModelPreserveModelVersion() {
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));
}
}