From 6bc3666a20bf57e7b97131598a8d240ae988dd37 Mon Sep 17 00:00:00 2001 From: Thibaut Lorrain Date: Sun, 14 Jul 2013 02:10:13 +0200 Subject: [PATCH] added a config option in mvn plugin to add packages to scan, see #3 #6 --- .../android/rezenerator/GenerateMojo.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/rezenerator-maven-plugin/src/main/java/com/tlorrain/android/rezenerator/GenerateMojo.java b/rezenerator-maven-plugin/src/main/java/com/tlorrain/android/rezenerator/GenerateMojo.java index f04130a..117c8bb 100644 --- a/rezenerator-maven-plugin/src/main/java/com/tlorrain/android/rezenerator/GenerateMojo.java +++ b/rezenerator-maven-plugin/src/main/java/com/tlorrain/android/rezenerator/GenerateMojo.java @@ -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; @@ -41,6 +42,12 @@ public class GenerateMojo extends AbstractMojo { @Parameter(defaultValue = "${project.basedir}/.rezenerator-cache~") private File cacheDirectory; + /** + * Packages to scan. + */ + @Parameter + private List scannedPackages; + public void execute() throws MojoExecutionException { getLog().info("input dir : " + inputDirectory); getLog().info("output dir : " + outputDirectory); @@ -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) {