Navigation Menu

Skip to content

Commit

Permalink
[maven] Add the "skip" flag and the support of "maven.test.skip".
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Jan 24, 2020
1 parent 49b0941 commit 84c03d9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
Expand Up @@ -218,6 +218,14 @@ protected MavenProject getProject() {
*/
protected abstract boolean isTestContext();

@Override
protected boolean isSkipped() {
if (isTestContext() && this.mavenTestSkip) {
return true;
}
return super.isSkipped();
}

/** Run compilation.
*
* @param classPath the classpath
Expand Down
Expand Up @@ -64,6 +64,12 @@ public abstract class AbstractSarlMojo extends AbstractMojo {
*/
protected MavenHelper mavenHelper;

/** General Maven flag for skipping tests.
* @since 0.11
*/
@Parameter(defaultValue = "${maven.test.skip}", required = true, readonly = true)
protected boolean mavenTestSkip;

/**
* The current Maven session.
*/
Expand Down Expand Up @@ -102,8 +108,28 @@ public abstract class AbstractSarlMojo extends AbstractMojo {
@Parameter(defaultValue = SARLConfig.FOLDER_TEST_SOURCE_SARL)
private File testInput;

/** Skip the execution of the mojo.
* @since 0.11
*/
@Parameter(defaultValue = "false")
private boolean skip;

/** Replies if the execution of the mojo should be skipped or not.
* This function checks the configuration tag "skip".
*
* @return {@code true} if the mojo should be skipped.
* @since 0.11
*/
protected boolean isSkipped() {
return this.skip;
}

@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
if (isSkipped()) {
getLog().info(Messages.AbstractSarlMojo_5);
return;
}
try {
this.mavenHelper = new MavenHelper(this.session, this.buildPluginManager, this.repositorySystem,
this.resolutionErrorHandler, getLog());
Expand Down
Expand Up @@ -71,6 +71,7 @@ public class Messages extends NLS {
public static String AbstractSarlMojo_2;
public static String AbstractSarlMojo_3;
public static String AbstractSarlMojo_4;
public static String AbstractSarlMojo_5;
public static String MavenBatchCompiler_0;
public static String AbstractCompileMojo_0;
public static String AbstractCompileMojo_1;
Expand Down
Expand Up @@ -34,6 +34,7 @@ AbstractSarlMojo_1 = Plugin not found: {0}
AbstractSarlMojo_2 = Goal not found {0}
AbstractSarlMojo_3 = Configuration that will be passed to {0}:\n{1}
AbstractSarlMojo_4 = Artifact not found in the plugin configuration: {0}
AbstractSarlMojo_5 = Skipping execution.
MavenBatchCompiler_0 = Unable to determine the latest version of maven-compiler-plugin. Use the version {0}.
AbstractCompileMojo_0 = The value ''{0}'' is not valid for the parameter 'javaCompiler'. Supported values are {1}. Use ''{2}'' as the default.
AbstractCompileMojo_1 = {0}, {1}
Expand Down

0 comments on commit 84c03d9

Please sign in to comment.