Skip to content

Commit

Permalink
Add skip parameter (#26) (#27)
Browse files Browse the repository at this point in the history
* Ignore IDE project files
* Add skip parameter to execute mojo (#26)
  • Loading branch information
ppalaga authored Oct 17, 2021
1 parent c3cc557 commit b5fa664
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml

# Eclipse
.project
.classpath
.settings/

# IDEA
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# OSX
.DS_Store

# VS Code
.vscode/
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ public class ExecuteMojo
@Parameter
private Map<String, String> defaults;


/**
* Skip the execution of this mojo.
*
* @since 2.2.0
*/
@Parameter(property = "gmaven.execute.skip", defaultValue = "false")
private boolean skip;

@Override
protected void run() throws Exception {
final ClassSource classSource = classSourceFactory.create(source);
Expand All @@ -101,4 +110,10 @@ protected void customizeProperties(final PropertiesBuilder builder) {
builder.setProperties(properties)
.setDefaults(defaults);
}

@Override
protected boolean isSkipped() {
return skip;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ protected MojoSupport() {
}

public void execute() throws MojoExecutionException, MojoFailureException {
if (isSkipped()) {
getLog().info("Skipping as requested by the user");
return;
}
try {
try {
log.trace("Prepare");
Expand Down Expand Up @@ -67,4 +71,8 @@ protected void prepare() throws Exception {
protected void cleanup() throws Exception {
// empty
}

protected boolean isSkipped() {
return false;
}
}

0 comments on commit b5fa664

Please sign in to comment.