diff --git a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndInitMojo.java b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndInitMojo.java index 60389ddd64..ff62757be1 100644 --- a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndInitMojo.java +++ b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndInitMojo.java @@ -31,7 +31,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -@Mojo(name = "initialize", defaultPhase = LifecyclePhase.INITIALIZE) +@Mojo(name = "initialize", defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true) public class BndInitMojo extends AbstractBndMojo { /** diff --git a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndIntegrationTestMojo.java b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndIntegrationTestMojo.java index ceb00c9c14..ca91766474 100644 --- a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndIntegrationTestMojo.java +++ b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndIntegrationTestMojo.java @@ -14,6 +14,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import aQute.bnd.build.Project; @@ -22,8 +23,32 @@ @Mojo(name = "integration-test", defaultPhase = LifecyclePhase.INTEGRATION_TEST, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) public class BndIntegrationTestMojo extends AbstractBndProjectMojo { + /** + * Set this to true to bypass unit tests entirely. Its use is + * NOT RECOMMENDED, especially if you enable it using the + * "maven.test.skip" property, because maven.test.skip disables both running the + * tests and compiling the tests. Consider using the skipTests + * parameter instead that only skip the execution of tests. + */ + @Parameter(property = "maven.test.skip") + private boolean skip; + + /** + * Set this to "true" to skip running tests, but still compile them. Its use is + * NOT RECOMMENDED, but quite convenient on occasion. + */ + @Parameter(property = "skipTests") + private boolean skipTests; + @Override protected void execute(Project project) throws Exception { + if (skip) { + return; + } + if (skipTests) { + getLog().warn("Tests execution is skipped!"); + return; + } String testcases = project.getProperty(Constants.TESTCASES); if (testcases == null) { return; diff --git a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndTestCompileMojo.java b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndTestCompileMojo.java index 1e726a8778..ae716fb559 100644 --- a/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndTestCompileMojo.java +++ b/tycho-bnd-plugin/src/main/java/org/eclipse/tycho/bnd/mojos/BndTestCompileMojo.java @@ -14,6 +14,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import aQute.bnd.build.Project; @@ -21,8 +22,18 @@ @Mojo(name = "test-compile", defaultPhase = LifecyclePhase.TEST_COMPILE, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) public class BndTestCompileMojo extends AbstractBndProjectMojo { + /** + * Set this to true to bypass compilation of test sources. Its use + * is NOT RECOMMENDED, but quite convenient on occasion. + */ + @Parameter(property = "maven.test.skip") + private boolean skip; + @Override protected void execute(Project project) throws Exception { + if (skip) { + return; + } project.compile(true); }