From aede276f9b68319d45d42f2c0e49dc42560f9021 Mon Sep 17 00:00:00 2001 From: Martin Bergljung Date: Tue, 28 Feb 2017 08:14:27 +0000 Subject: [PATCH] Made sure alfresco:run can be executed without interference from alfresco:it,#401 --- .../maven/plugin/IntegrationTestMojo.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/IntegrationTestMojo.java b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/IntegrationTestMojo.java index 45d75d74..e23e9e68 100644 --- a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/IntegrationTestMojo.java +++ b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/IntegrationTestMojo.java @@ -30,6 +30,7 @@ import org.zeroturnaround.zip.ZipUtil; import java.io.File; import java.util.ArrayList; import java.util.List; +import java.util.Properties; import static org.twdata.maven.mojoexecutor.MojoExecutor.*; @@ -60,6 +61,26 @@ public class IntegrationTestMojo extends AbstractRunMojo { pluginManager ); + // Check if we should skip this Mojo execution, i.e. if tests have been + // skipped by the user + Properties sysProperties = execEnv.getMavenSession().getSystemProperties(); + boolean skipThisMojo = sysProperties.containsKey("skipTests") || + sysProperties.containsKey("skipITs") || + sysProperties.containsKey("maven.test.skip"); + if (skipThisMojo) { + getLog().info("Skipping integration testing."); + return; + } + + List goals = execEnv.getMavenSession().getGoals(); + if (goals.contains("alfresco:run")) { + sysProperties.put("skipTests", "true"); + getLog().info("Skipping integration testing as alfresco:run is active."); + return; + } + +// execEnv.getMavenSession().getGoals().add("alfresco:it"); + if (enableSolr) { unpackSolrConfig(); fixSolrHomePath();