diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 48c3546d4..24d837339 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -70,7 +70,7 @@ jobs: run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*setup*,*springboot-3-*,*compile-jsp-source-17-*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # Run tests - name: Run tests - run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -D"invoker.test"="*dev-it*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" + run: ./mvnw -V verify --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -Ponline-its -D"invoker.streamLogsOnFailures"=true -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" # WINDOWS BUILD build-windows: diff --git a/liberty-maven-plugin/src/it/dev-it/pom.xml b/liberty-maven-plugin/src/it/dev-it/pom.xml index b0d6576ae..218102db3 100755 --- a/liberty-maven-plugin/src/it/dev-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/pom.xml @@ -58,9 +58,7 @@ -enableassertions ${project.build.directory} - **/*DevRecompileWithCustomExecutionIdTest.java - **/*DevRecompileWithDefaultExecutionIdTest.java - **/*DevTest.java + **/*Test.java @pom.version@ diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml index ffb5356e1..2500534bc 100755 --- a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-default-execution-id/pom.xml @@ -4,7 +4,7 @@ 4.0.0 dev-it-tests - dev-sample-proj + basic-dev-project-with-default-execution-id 1.0-SNAPSHOT war diff --git a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml index ca47792bd..8531de9fa 100755 --- a/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/resources/basic-dev-project-with-execution-id/pom.xml @@ -4,7 +4,7 @@ 4.0.0 dev-it-tests - dev-sample-proj + basic-dev-project-with-execution-id 1.0-SNAPSHOT war diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java index e6e526248..ea3795bab 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseDevTest.java @@ -151,58 +151,6 @@ protected static void setUpBeforeClass(String params, String projectRoot, boolea } } - /** - * Setup and optionally start dev/run - * - * @param params Params for the dev/run goal - * @param projectRoot The Maven project root - * @param isDevMode Use dev if true, use run if false. Ignored if startProcessDuringSetup is false. - * @param startProcessDuringSetup If this method should start the actual dev/run process - * @param libertyConfigModule For multi module project, the module where Liberty configuration is located - * @param pomModule For multi module project, the module where the pom is located. If null, use the project root. - * @throws IOException - * @throws InterruptedException - * @throws FileNotFoundException - */ - protected static void setUpBeforeClassWithoutTemp(String params, String projectRoot, boolean isDevMode, boolean startProcessDuringSetup, String libertyConfigModule, String pomModule) throws IOException, InterruptedException, FileNotFoundException { - customLibertyModule = libertyConfigModule; - customPomModule = pomModule; - - basicDevProj = new File(projectRoot); - - tempProj = basicDevProj; - assertTrue("temp directory does not exist", tempProj.exists()); - - assertTrue(projectRoot+" directory does not exist", basicDevProj.exists()); - - assertTrue("temp directory does not contain expected copied files from "+projectRoot, tempProj.listFiles().length > 0); - - // in case cleanup was not successful, try to delete the various log files so we can proceed - logFile = new File(basicDevProj, "logFile.txt"); - if (logFile.exists()) { - assertTrue("Could not delete log file: "+logFile.getCanonicalPath(), logFile.delete()); - } - assertTrue("log file already existed: "+logFile.getCanonicalPath(), logFile.createNewFile()); - logErrorFile = new File(basicDevProj, "logErrorFile.txt"); - if (logErrorFile.exists()) { - assertTrue("Could not delete logError file: "+logErrorFile.getCanonicalPath(), logErrorFile.delete()); - } - assertTrue("logError file already existed: "+logErrorFile.getCanonicalPath(), logErrorFile.createNewFile()); - - if (customPomModule == null) { - pom = new File(tempProj, "pom.xml"); - } else { - pom = new File(new File(tempProj, customPomModule), "pom.xml"); - } - assertTrue(pom.getCanonicalPath()+" file does not exist", pom.exists()); - - replaceVersion(); - - if (startProcessDuringSetup) { - startProcess(params, isDevMode); - } - } - protected static void startProcess(String params, boolean isDevMode) throws IOException, InterruptedException, FileNotFoundException { startProcess(params, isDevMode, "mvn liberty:"); } diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java index 62abc17e0..c9f6bd2ea 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithCustomExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithCustomExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClassWithoutTemp(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-execution-id", true, false, null, null); startProcess(null, true, "mvn compile liberty:", true); } diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java index 2b8c76fef..f714a4d68 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/DevRecompileWithDefaultExecutionIdTest.java @@ -36,7 +36,7 @@ public class DevRecompileWithDefaultExecutionIdTest extends BaseDevTest { @BeforeClass public static void setUpBeforeClass() throws Exception { - setUpBeforeClassWithoutTemp(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); + setUpBeforeClass(null, "../resources/basic-dev-project-with-default-execution-id", true, false, null, null); startProcess(null, true, "mvn compile liberty:", true); } diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java index a8e5432d7..45585cdf0 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java @@ -22,9 +22,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginExecution; @@ -269,8 +271,9 @@ public static Xpp3Dom getPluginGoalConfig(Plugin plugin, String goal, Log log) { String execId = "default"; int numExec = 0; - List executions = plugin.getExecutions(); - if (executions != null) { + List executions = plugin.getExecutions() + .stream().sorted(Comparator.comparing(PluginExecution::getPriority)).collect(Collectors.toList()); + if (!executions.isEmpty()) { for (PluginExecution e : executions) { if (e.getGoals() != null && e.getGoals().contains(goal)) { if (numExec == 0) { @@ -289,10 +292,10 @@ public static Xpp3Dom getPluginGoalConfig(Plugin plugin, String goal, Log log) { config = (Xpp3Dom) plugin.getConfiguration(); } if (numExec > 1) { - log.warn(plugin.getArtifactId() + ":" + goal + log.warn(plugin.getArtifactId() + ":" + goal + " goal has multiple execution configurations (default to \"" + execId + "\" execution)"); } - + if (config == null) { config = configuration(); } else {