Skip to content

Commit

Permalink
added a config option in mvn plugin to add packages to scan, see #3 #6
Browse files Browse the repository at this point in the history
  • Loading branch information
fredszaq committed Jul 14, 2013
1 parent 735ddab commit 6bc3666
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.apache.maven.plugins.annotations.LifecyclePhase.INITIALIZE;

import java.io.File;
import java.util.List;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand Down Expand Up @@ -41,6 +42,12 @@ public class GenerateMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.basedir}/.rezenerator-cache~")
private File cacheDirectory;

/**
* Packages to scan.
*/
@Parameter
private List<String> scannedPackages;

public void execute() throws MojoExecutionException {
getLog().info("input dir : " + inputDirectory);
getLog().info("output dir : " + outputDirectory);
Expand All @@ -50,15 +57,13 @@ public void execute() throws MojoExecutionException {

configuration.setInDir(inputDirectory)//
.setBaseOutDir(outputDirectory)//
.addScannedPackage("com.tlorrain.android")//
.addScannedPackage("com.tlorrain.android")// TODO add this by
// default in conf
.setLogger(new MavenLogger());

String pakages = System.getProperties().getProperty("rezenerator.scanned.packages");
if (pakages != null) {
for (String pkg : pakages.split(",")) {
configuration.addScannedPackage(pkg);
}

for (String pkg : scannedPackages) {
getLog().info("add scanned package: " + pkg);
configuration.addScannedPackage(pkg);
}

if (System.getProperties().getProperty("rezenerator.force.update") != null) {
Expand Down

0 comments on commit 6bc3666

Please sign in to comment.