Skip to content

Commit

Permalink
#81 Possibility to skip plugin execution
Browse files Browse the repository at this point in the history
  • Loading branch information
taranion authored and gunnarmorling committed Jan 13, 2019
1 parent 9c2d7d5 commit 36c09a5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Expand Up @@ -92,6 +92,9 @@ public class AddModuleInfoMojo extends AbstractMojo {
@Parameter(property = "overwriteExistingFiles", defaultValue = "false")
private boolean overwriteExistingFiles;

@Parameter(property = "moditect.skip", defaultValue = "false")
private boolean skip;

@Parameter
private MainModuleConfiguration module;

Expand All @@ -103,6 +106,18 @@ public class AddModuleInfoMojo extends AbstractMojo {

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
// Check if this plugin should be skipped
if (skip) {
getLog().debug("Mojo 'add-module-info' skipped by configuration");
return;
}
// Don't try to run this plugin, when packaging type is 'pom'
// (may be better to only run it on specific packaging types, like 'jar')
if (project.getModel().getPackaging().equalsIgnoreCase("pom")) {
getLog().debug("Mojo 'add-module-info' not executed on packaging type '"+project.getModel().getPackaging()+"'");
return;
}

Path outputPath = outputDirectory.toPath();

createDirectories();
Expand Down
Expand Up @@ -91,9 +91,24 @@ public class GenerateModuleInfoMojo extends AbstractMojo {
@Parameter(property = "moditect.addServiceUses", defaultValue = "false")
private boolean addServiceUsesOverride;

@Parameter(property = "moditect.skip", defaultValue = "false")
private boolean skip;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
createDirectories();
// Check if this plugin should be skipped
if (skip) {
getLog().debug("Mojo 'generate-module-info' skipped by configuration");
return;
}
// Don't try to run this plugin, when packaging type is 'pom'
// (may be better to only run it on specific packaging types, like 'jar')
if (project.getModel().getPackaging().equalsIgnoreCase("pom")) {
getLog().debug("Mojo 'generate-module-info' not executed on packaging type '"+project.getModel().getPackaging()+"'");
return;
}

createDirectories();

ArtifactResolutionHelper artifactResolutionHelper = new ArtifactResolutionHelper( repoSystem, repoSession, remoteRepos );
ModuleInfoGenerator moduleInfoGenerator = new ModuleInfoGenerator(
Expand Down

0 comments on commit 36c09a5

Please sign in to comment.