Skip to content

Commit

Permalink
[maven] The "maven.test.skip" property is read from the current session.
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 31, 2020
1 parent 2efb0de commit 24923de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Expand Up @@ -220,8 +220,17 @@ protected MavenProject getProject() {

@Override
protected boolean isSkipped() {
if (isTestContext() && this.mavenTestSkip) {
return true;
if (isTestContext()) {
// Check the general Maven test skipping flag
boolean mavenTestSkip = false;
try {
mavenTestSkip = Boolean.parseBoolean(this.session.getUserProperties().getProperty("maven.test.skip", "false")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (Throwable exception) {
mavenTestSkip = false;
}
if (mavenTestSkip) {
return true;
}
}
return super.isSkipped();
}
Expand Down
Expand Up @@ -64,17 +64,11 @@ 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.
*/
@Parameter(defaultValue = "${session}", required = true, readonly = true)
private MavenSession session;
protected MavenSession session;

/**
* The Build PluginManager component.
Expand Down

0 comments on commit 24923de

Please sign in to comment.