Author: tchemit Date: 2010-01-01 17:46:56 +0100 (Fri, 01 Jan 2010) New Revision: 305 Modified: trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java trunk/maven-processor-plugin/src/site/apt/index.apt trunk/pom.xml Log: - use last version of mavenpom and maven-helper-plugin new api - fix doc Modified: trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java =================================================================== --- trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java 2009-12-18 13:37:06 UTC (rev 304) +++ trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java 2010-01-01 16:46:56 UTC (rev 305) @@ -30,7 +30,6 @@ import java.io.File; import java.io.FileReader; import java.io.FileWriter; -import java.io.IOException; import java.util.Arrays; import java.util.Map; import java.util.Map.Entry; @@ -123,29 +122,29 @@ * @parameter expression="${processor.overwrite}" default-value="false" * @since 0.10 */ - private boolean overwrite; + protected boolean overwrite; /** * Permet d'obtenir plus d'information * * @parameter expression="${processor.verbose}" default-value="${maven.verbose}" * @since 0.10 */ - private boolean verbose; + protected boolean verbose; /** * Pour utiliser en phase de test * * @parameter expression="${processor.testPhase}" default-value="false" * @since 1.0.3 */ - private boolean testPhase; + protected boolean testPhase; /** * Les fichiers à traiter */ protected Map<String, String> filesToTreate; - public ProcessorPlugin() { - super("all files are up-to-date."); - } +// public ProcessorPlugin() { +// super("all files are up-to-date."); +// } @Override public boolean isVerbose() { @@ -168,11 +167,13 @@ } @Override - protected boolean init() throws Exception { + protected void init() throws Exception { +// protected boolean init() throws Exception { if (filters.isEmpty()) { - getLog().warn("No filters to use, skip execution."); - return false; + return; +// getLog().warn("No filters to use, skip execution."); +// return false; } MirroredFileUpdater updater = overwrite ? null : new MirroredFileUpdater(fileInPattern, fileOutPattern, srcDir, destDir); @@ -185,16 +186,29 @@ filesToTreate = getFilesToTreate(aIncludes, aExcludes, srcDir, updater); +// return true; + } + + @Override + protected boolean checkSkip() { + if (filters.isEmpty()) { + getLog().warn("No filters to use, skip execution."); + return false; + } + if (filesToTreate==null || filesToTreate.isEmpty()) { + getLog().info("No file to process."); + return false; + } return true; } @Override protected void doAction() throws Exception { - if (filesToTreate.isEmpty()) { - getLog().info("No file to process."); - return; - } +// if (filesToTreate.isEmpty()) { +// getLog().info("No file to process."); +// return; +// } if (isVerbose()) { printConfig(); @@ -214,12 +228,13 @@ getLog().info("Process " + srcFile); } // creation du repertoire pour le fichier destination - if (!dstFile.getParentFile().exists()) { - boolean b = dstFile.getParentFile().mkdirs(); - if (!b) { - throw new IOException("could not create directory " + dstFile); - } - } + createDirectoryIfNecessary(dstFile.getParentFile()); +// if (!dstFile.getParentFile().exists()) { +// boolean b = dstFile.getParentFile().mkdirs(); +// if (!b) { +// throw new IOException("could not create directory " + dstFile); +// } +// } processor.process(new FileReader(srcFile), new FileWriter(dstFile)); } Modified: trunk/maven-processor-plugin/src/site/apt/index.apt =================================================================== (Binary files differ) Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-12-18 13:37:06 UTC (rev 304) +++ trunk/pom.xml 2010-01-01 16:46:56 UTC (rev 305) @@ -9,7 +9,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>mavenpom</artifactId> - <version>1.1.3</version> + <version>1.1.4-SNAPSHOT</version> </parent> <artifactId>processor</artifactId>