Skip to content

Commit

Permalink
Merge pull request #14 from nickman/master
Browse files Browse the repository at this point in the history
Support -DskipParanamer On Command Line in Maven Plugin
  • Loading branch information
paul-hammant committed Jul 18, 2014
2 parents 9c73641 + 8143c94 commit 9b55f32
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@

package com.thoughtworks.paranamer.mojo;

import java.io.IOException;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

import com.thoughtworks.paranamer.generator.ParanamerGenerator;
import com.thoughtworks.paranamer.generator.QdoxParanamerGenerator;

import java.io.IOException;


/**
* Mojo to generate parameter names via ParanamerGenerator
Expand All @@ -49,6 +49,18 @@
* @requiresDependencyResolution compile
*/
public class ParanamerGeneratorMojo extends AbstractMojo {

/** THe system property name, which if set, will skip execution of this mojo */
public static final String skipProp = "skipParanamer";

/**
* Determines if the skip property is set
*
* @return true if the skip property is set, false otherwise
*/
public boolean skip() {
return System.getProperties().containsKey(skipProp);
}

/**
* The directory containing the Java source files
Expand All @@ -72,6 +84,10 @@ public class ParanamerGeneratorMojo extends AbstractMojo {
private ParanamerGenerator generator = new QdoxParanamerGenerator();

public void execute() throws MojoExecutionException, MojoFailureException {
if(skip()) {
getLog().info("\n\tSkipping ParanamerGeneratorMojo as \"" + skipProp + "\" system property is set\n");
return;
}
getLog().info("Generating parameter names from " + sourceDirectory + " to " + outputDirectory);
try {
generator.processSourcePath(sourceDirectory, outputDirectory);
Expand Down

0 comments on commit 9b55f32

Please sign in to comment.