r427 - in trunk: . maven-processor-plugin processor-maven-plugin processor-maven-plugin/src/main/java/org/nuiton/processor/plugin processor-maven-plugin/src/site/apt
Author: tchemit Date: 2012-11-16 17:03:33 +0100 (Fri, 16 Nov 2012) New Revision: 427 Url: http://nuiton.org/repositories/revision/processor/427 Log: fixes #2440: Change m-processor-p to processor-m-p Added: trunk/processor-maven-plugin/ trunk/processor-maven-plugin/pom.xml trunk/processor-maven-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java Removed: trunk/maven-processor-plugin/LICENSE.txt trunk/maven-processor-plugin/README.txt trunk/maven-processor-plugin/changelog.txt trunk/maven-processor-plugin/pom.xml trunk/maven-processor-plugin/src/ trunk/processor-maven-plugin/pom.xml trunk/processor-maven-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java Modified: trunk/pom.xml trunk/processor-maven-plugin/src/site/apt/index.apt Deleted: trunk/maven-processor-plugin/LICENSE.txt =================================================================== --- trunk/maven-processor-plugin/LICENSE.txt 2012-11-16 16:00:40 UTC (rev 426) +++ trunk/maven-processor-plugin/LICENSE.txt 2012-11-16 16:03:33 UTC (rev 427) @@ -1,166 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - Deleted: trunk/maven-processor-plugin/README.txt =================================================================== --- trunk/maven-processor-plugin/README.txt 2012-11-16 16:00:40 UTC (rev 426) +++ trunk/maven-processor-plugin/README.txt 2012-11-16 16:03:33 UTC (rev 427) @@ -1,2 +0,0 @@ -To deploy new version of pom: mvn deploy -To install localy: mvn install Deleted: trunk/maven-processor-plugin/changelog.txt =================================================================== --- trunk/maven-processor-plugin/changelog.txt 2012-11-16 16:00:40 UTC (rev 426) +++ trunk/maven-processor-plugin/changelog.txt 2012-11-16 16:03:33 UTC (rev 427) @@ -1 +0,0 @@ -No more used, we will soon make optional multi-module childs changelog.txt (mavenpom>1.0.0) \ No newline at end of file Deleted: trunk/maven-processor-plugin/pom.xml =================================================================== --- trunk/maven-processor-plugin/pom.xml 2012-11-16 16:00:40 UTC (rev 426) +++ trunk/maven-processor-plugin/pom.xml 2012-11-16 16:03:33 UTC (rev 427) @@ -1,159 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - Nuiton Processor :: Maven plugin - - $Id$ - $HeadURL$ - %% - Copyright (C) 2006 - 2010 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>processor</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> - - <groupId>org.nuiton.processor</groupId> - <artifactId>processor-maven-plugin</artifactId> - - <dependencies> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>nuiton-processor</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-plugin-api</artifactId> - </dependency> - - <!-- tests dependencies --> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-plugin-api</artifactId> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-api</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.maven.plugin-tools</groupId> - <artifactId>maven-plugin-annotations</artifactId> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - <name>Nuiton Processor :: Maven plugin</name> - <inceptionYear>2006</inceptionYear> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - - <packaging>maven-plugin</packaging> - - <build> - - <pluginManagement> - <plugins> - - <plugin> - <artifactId>maven-plugin-plugin</artifactId> - <configuration> - <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> - </configuration> - <executions> - <execution> - <goals> - <goal>helpmojo</goal> - <goal>descriptor</goal> - </goals> - </execution> - </executions> - </plugin> - - </plugins> - </pluginManagement> - - </build> - <profiles> - - <!-- perform only on a release stage when using the maven-release-plugin --> - <profile> - <id>reporting</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - - <reporting> - - <plugins> - - <plugin> - <artifactId>maven-plugin-plugin</artifactId> - <version>${pluginPluginVersion}</version> - </plugin> - - </plugins> - </reporting> - - </profile> - </profiles> - -</project> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2012-11-16 16:00:40 UTC (rev 426) +++ trunk/pom.xml 2012-11-16 16:03:33 UTC (rev 427) @@ -41,7 +41,7 @@ <modules> <module>nuiton-processor</module> - <module>maven-processor-plugin</module> + <module>processor-maven-plugin</module> <module>ant-processor-task</module> </modules> Deleted: trunk/processor-maven-plugin/pom.xml =================================================================== --- trunk/maven-processor-plugin/pom.xml 2012-10-30 07:44:33 UTC (rev 421) +++ trunk/processor-maven-plugin/pom.xml 2012-11-16 16:03:33 UTC (rev 427) @@ -1,165 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - Nuiton Processor :: Maven plugin - - $Id$ - $HeadURL$ - %% - Copyright (C) 2006 - 2010 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>processor</artifactId> - <version>1.3-SNAPSHOT</version> - </parent> - - <groupId>org.nuiton.processor</groupId> - <artifactId>maven-processor-plugin</artifactId> - - <dependencies> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>nuiton-processor</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-plugin</artifactId> - </dependency> - - <!-- FIXME si on ne le rajoute pas, on se retrouve avec la version 1.1 qui ne convient pas --> - <!--dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - <scope>compile</scope> - </dependency--> - - <!-- tests dependencies --> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-plugin</artifactId> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-api</artifactId> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - <name>Nuiton Processor :: Maven plugin</name> - <inceptionYear>2006</inceptionYear> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - - <packaging>maven-plugin</packaging> - - <profiles> - <!-- perform only on a release stage when using the maven-release-plugin --> - <profile> - <id>release-profile</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - - <build> - - <plugins> - - <plugin> - <artifactId>maven-plugin-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>helpmojo</goal> - </goals> - </execution> - </executions> - </plugin> - - </plugins> - - </build> - - </profile> - - <!-- perform only on a release stage when using the maven-release-plugin --> - <profile> - <id>reporting</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - - <reporting> - - <plugins> - - <plugin> - <artifactId>maven-plugin-plugin</artifactId> - <version>2.5.1</version> - </plugin> - - </plugins> - </reporting> - - </profile> - </profiles> - -</project> Copied: trunk/processor-maven-plugin/pom.xml (from rev 426, trunk/maven-processor-plugin/pom.xml) =================================================================== --- trunk/processor-maven-plugin/pom.xml (rev 0) +++ trunk/processor-maven-plugin/pom.xml 2012-11-16 16:03:33 UTC (rev 427) @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Nuiton Processor :: Maven plugin + + $Id$ + $HeadURL$ + %% + Copyright (C) 2006 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.nuiton</groupId> + <artifactId>processor</artifactId> + <version>1.3-SNAPSHOT</version> + </parent> + + <groupId>org.nuiton.processor</groupId> + <artifactId>processor-maven-plugin</artifactId> + + <dependencies> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>nuiton-processor</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-plugin-api</artifactId> + </dependency> + + <!-- tests dependencies --> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-plugin-api</artifactId> + <scope>test</scope> + <classifier>tests</classifier> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Nuiton Processor :: Maven plugin</name> + <inceptionYear>2006</inceptionYear> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>maven-plugin</packaging> + + <build> + + <pluginManagement> + <plugins> + + <plugin> + <artifactId>maven-plugin-plugin</artifactId> + <configuration> + <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> + </configuration> + <executions> + <execution> + <goals> + <goal>helpmojo</goal> + <goal>descriptor</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + </pluginManagement> + + </build> + <profiles> + + <!-- perform only on a release stage when using the maven-release-plugin --> + <profile> + <id>reporting</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + + <reporting> + + <plugins> + + <plugin> + <artifactId>maven-plugin-plugin</artifactId> + <version>${pluginPluginVersion}</version> + </plugin> + + </plugins> + </reporting> + + </profile> + </profiles> + +</project> Deleted: trunk/processor-maven-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java =================================================================== --- trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java 2012-10-30 07:44:33 UTC (rev 421) +++ trunk/processor-maven-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java 2012-11-16 16:03:33 UTC (rev 427) @@ -1,297 +0,0 @@ -/* - * #%L - * Nuiton Processor :: Maven plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2006 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ - -package org.nuiton.processor.plugin; - -import org.apache.commons.lang.StringUtils; -import org.apache.maven.project.MavenProject; -import org.nuiton.io.MirroredFileUpdater; -import org.nuiton.plugin.AbstractPlugin; -import org.nuiton.plugin.PluginHelper; -import org.nuiton.plugin.PluginWithEncoding; -import org.nuiton.processor.Processor; -import org.nuiton.processor.ProcessorUtil; - -import java.io.File; -import java.util.Arrays; -import java.util.Map; -import java.util.Map.Entry; - -/** - * Maven2 plugin for Nuiton Processor. - * <p/> - * Created: 14 avril 2006 - * - * @author ruchaud - * @version $Revision$ - * <p/> - * Last update: $Date$ - * by : $Date$ * - * @goal process - * @requiresProject true - */ -public class ProcessorPlugin extends AbstractPlugin implements PluginWithEncoding { - - /** - * Dependance du projet. - * - * @parameter default-value="${project}" - * @required - * @since 1.0.0 - */ - protected MavenProject project; - - /** - * Répertoire source - * - * @parameter expression="${processor.srcDir}" default-value="${basedir}/src/main/java" - * @since 0.10 - */ - protected File srcDir; - - /** - * Répertoire cible - * - * @parameter expression="${processor.destDir}" default-value="${basedir}/target/processed-sources/java" - * @since 0.10 - */ - protected File destDir; - - /** - * Fichiers à inclure. - * <p/> - * Il s'agit des expressions séparées par des virgules. - * <p/> - * Exemple : - * <p/> - * *.java,*.xml - * - * @parameter expression="${processor.includes}" - * @since 0.10 - */ - protected String includes; - - /** - * Fichiers à exclure. - * <p/> - * Il s'agit des expressions spérarées par des virgules. - * <p/> - * Exemple : - * <p/> - * *.java,*.xml - * - * @parameter expression="${processor.excludes}" - * @since 0.10 - */ - protected String excludes; - - /** - * ??? - * - * @parameter expression="${processor.fileInPattern}" default-value="" - * @since 0.10 - */ - protected String fileInPattern = ""; - - /** - * @parameter expression="${processor.fileOutPattern}" default-value="" - * @since 0.10 - */ - protected String fileOutPattern = ""; - - /** - * Les filtres a utiliser par le processor, séparés par des virgules - * - * @parameter expression="${processor.filters}" default-value="org.nuiton.processor.filters.NoActionFilter" - * @since 0.10 - */ - protected String filters; - - /** - * Encoding used to read and writes files. - * <p/> - * <b>Note:</b> If nothing is filled here, we will use the system - * property {@code file.encoding}. - * - * @parameter expression="${processor.encoding}" default-value="${project.build.sourceEncoding}" - * @required - * @since 1.0.4 - */ - private String encoding; - - /** - * Ecrase les fichiers générés - * - * @parameter expression="${processor.overwrite}" default-value="false" - * @since 0.10 - */ - protected boolean overwrite; - - /** - * Permet d'obtenir plus d'information - * - * @parameter expression="${processor.verbose}" default-value="${maven.verbose}" - * @since 0.10 - */ - protected boolean verbose; - - /** - * Pour utiliser en phase de test - * - * @parameter expression="${processor.testPhase}" default-value="false" - * @since 1.0.3 - */ - protected boolean testPhase; - - /** Les fichiers à traiter */ - protected Map<String, String> filesToTreate; - - public boolean isVerbose() { - return verbose; - } - - public void setVerbose(boolean verbose) { - this.verbose = verbose; - } - - public MavenProject getProject() { - return project; - } - - public void setProject(MavenProject project) { - this.project = project; - } - - public final String getEncoding() { - return encoding; - } - - public final void setEncoding(String encoding) { - this.encoding = encoding; - } - - @Override - protected void init() throws Exception { - - if (StringUtils.isEmpty(filters)) { - return; - } - - MirroredFileUpdater updater = overwrite ? null : - new MirroredFileUpdater(fileInPattern, - fileOutPattern, - srcDir, - destDir - ); - - if (updater != null) { - updater.setDestinationDirectory(destDir); - } - String[] aIncludes = includes.split(","); - String[] aExcludes = excludes == null ? null : excludes.split(","); - - filesToTreate = getFilesToTreate(aIncludes, aExcludes, srcDir, updater); - } - - @Override - protected boolean checkSkip() { - if (StringUtils.isEmpty(filters)) { - 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 (isVerbose()) { - printConfig(); - } - - long t0 = System.nanoTime(); - - Processor processor = ProcessorUtil.newProcessor(filters, ","); - - getLog().info("Processing " + filesToTreate.size() + " files(s)."); - - for (Entry<String, String> entry : filesToTreate.entrySet()) { - File srcFile = new File(srcDir, entry.getKey()); - File dstFile = new File(entry.getValue()); - - if (isVerbose()) { - getLog().info("Process " + srcFile); - } - // creation du repertoire pour le fichier destination - createDirectoryIfNecessary(dstFile.getParentFile()); - - ProcessorUtil.doProcess(processor, srcFile, dstFile, getEncoding()); - } - - if (isVerbose()) { - long time = System.nanoTime() - t0; - getLog().info("done in " + PluginHelper.convertTime(time)); - } - // on indique que le repertoire entrant n'est plus dans le build - // car sinon on va avoir des classes dupliquées - if (testPhase) { - removeTestCompileSourceRoots(srcDir); - } else { - - removeCompileSourceRoots(srcDir); - } - - // le repertoire sortant est dans le build de maven - if (testPhase) { - addTestCompileSourceRoots(destDir); - } else { - addCompileSourceRoots(destDir); - } - } - - protected void printConfig() { - getLog().info("config - srcDir " + srcDir); - getLog().info("config - destDir " + destDir); - getLog().info("config - includes " + includes); - getLog().info("config - filters " + Arrays.asList( - PluginHelper.splitAndTrim(filters, ","))); - if (excludes != null) { - getLog().info("config - excludes " + excludes); - } - if (!StringUtils.isEmpty(fileInPattern)) { - getLog().info("config - fileInPattern " + fileInPattern); - } - if (!StringUtils.isEmpty(fileOutPattern)) { - getLog().info("config - fileOutPattern " + fileOutPattern); - } - if (overwrite) { - getLog().info("config - overwrite " + overwrite); - } - } -} Copied: trunk/processor-maven-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java (from rev 424, trunk/maven-processor-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java) =================================================================== --- trunk/processor-maven-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java (rev 0) +++ trunk/processor-maven-plugin/src/main/java/org/nuiton/processor/plugin/ProcessorPlugin.java 2012-11-16 16:03:33 UTC (rev 427) @@ -0,0 +1,299 @@ +/* + * #%L + * Nuiton Processor :: Maven plugin + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2006 - 2010 CodeLutin, Tony Chemit + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package org.nuiton.processor.plugin; + +import org.apache.commons.lang.StringUtils; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.nuiton.io.MirroredFileUpdater; +import org.nuiton.plugin.AbstractPlugin; +import org.nuiton.plugin.PluginHelper; +import org.nuiton.plugin.PluginWithEncoding; +import org.nuiton.processor.Processor; +import org.nuiton.processor.ProcessorUtil; + +import java.io.File; +import java.util.Arrays; +import java.util.Map; +import java.util.Map.Entry; + +/** + * Maven2 plugin for Nuiton Processor. + * <p/> + * Created: 14 avril 2006 + * + * @author jruchaud <ruchaud@codelutin.com> + * @author tchemit <chemit@codelutin.com> + */ +@Mojo(name = "processor", requiresProject = true) +public class ProcessorPlugin extends AbstractPlugin implements PluginWithEncoding { + + /** + * Dependance du projet. + * + * @since 1.0.0 + */ + @Component + protected MavenProject project; + + /** + * Répertoire source. + * + * @since 0.10 + */ + @Parameter(property = "processor.srcDir", defaultValue = "${basedir}/src/main/java") + protected File srcDir; + + /** + * Répertoire cible. + * + * @since 0.10 + */ + @Parameter(property = "processor.destDir", defaultValue = "${basedir}/target/processed-sources/java") + protected File destDir; + + /** + * Fichiers à inclure. + * <p/> + * Il s'agit des expressions séparées par des virgules. + * <p/> + * Exemple : + * <p/> + * *.java,*.xml + * + * @since 0.10 + */ + @Parameter(property = "processor.includes") + protected String includes; + + /** + * Fichiers à exclure. + * <p/> + * Il s'agit des expressions spérarées par des virgules. + * <p/> + * Exemple : + * <p/> + * *.java,*.xml + * + * @since 0.10 + */ + @Parameter(property = "processor.excludes") + protected String excludes; + + /** + * TODO + * + * @since 0.10 + */ + @Parameter(property = "processor.fileInPattern", defaultValue = "") + protected String fileInPattern = ""; + + /** + * TODO + * + * @since 0.10 + */ + @Parameter(property = "processor.fileOutPattern", defaultValue = "") + protected String fileOutPattern = ""; + + /** + * Les filtres a utiliser par le processor, séparés par des virgules + * + * @since 0.10 + */ + @Parameter(property = "processor.filters", + defaultValue = "org.nuiton.processor.filters.NoActionFilter") + protected String filters; + + /** + * Encoding used to read and writes files. + * <p/> + * <b>Note:</b> If nothing is filled here, we will use the system + * property {@code file.encoding}. + * + * @since 1.0.4 + */ + @Parameter(property = "processor.encoding", + defaultValue = "${project.build.sourceEncoding}", + required = true) + private String encoding; + + /** + * Ecrase les fichiers générés. + * + * @since 0.10 + */ + @Parameter(property = "processor.overwrite", defaultValue = "false") + protected boolean overwrite; + + /** + * Permet d'obtenir plus d'information. + * + * @since 0.10 + */ + @Parameter(property = "processor.verbose", defaultValue = "${maven.verbose}") + protected boolean verbose; + + /** + * Pour utiliser en phase de test. + * + * @since 1.0.3 + */ + @Parameter(property = "processor.testPhase", defaultValue = "false") + protected boolean testPhase; + + /** Les fichiers à traiter */ + protected Map<String, String> filesToTreate; + + public boolean isVerbose() { + return verbose; + } + + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + + public MavenProject getProject() { + return project; + } + + public void setProject(MavenProject project) { + this.project = project; + } + + public final String getEncoding() { + return encoding; + } + + public final void setEncoding(String encoding) { + this.encoding = encoding; + } + + @Override + protected void init() throws Exception { + + if (StringUtils.isEmpty(filters)) { + return; + } + + MirroredFileUpdater updater = overwrite ? null : + new MirroredFileUpdater(fileInPattern, + fileOutPattern, + srcDir, + destDir + ); + + if (updater != null) { + updater.setDestinationDirectory(destDir); + } + String[] aIncludes = includes.split(","); + String[] aExcludes = excludes == null ? null : excludes.split(","); + + filesToTreate = getFilesToTreate(aIncludes, aExcludes, srcDir, updater); + } + + @Override + protected boolean checkSkip() { + if (StringUtils.isEmpty(filters)) { + 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 (isVerbose()) { + printConfig(); + } + + long t0 = System.nanoTime(); + + Processor processor = ProcessorUtil.newProcessor(filters, ","); + + getLog().info("Processing " + filesToTreate.size() + " files(s)."); + + for (Entry<String, String> entry : filesToTreate.entrySet()) { + File srcFile = new File(srcDir, entry.getKey()); + File dstFile = new File(entry.getValue()); + + if (isVerbose()) { + getLog().info("Process " + srcFile); + } + // creation du repertoire pour le fichier destination + createDirectoryIfNecessary(dstFile.getParentFile()); + + ProcessorUtil.doProcess(processor, srcFile, dstFile, getEncoding()); + } + + if (isVerbose()) { + long time = System.nanoTime() - t0; + getLog().info("done in " + PluginHelper.convertTime(time)); + } + // on indique que le repertoire entrant n'est plus dans le build + // car sinon on va avoir des classes dupliquées + if (testPhase) { + removeTestCompileSourceRoots(srcDir); + } else { + + removeCompileSourceRoots(srcDir); + } + + // le repertoire sortant est dans le build de maven + if (testPhase) { + addTestCompileSourceRoots(destDir); + } else { + addCompileSourceRoots(destDir); + } + } + + protected void printConfig() { + getLog().info("config - srcDir " + srcDir); + getLog().info("config - destDir " + destDir); + getLog().info("config - includes " + includes); + getLog().info("config - filters " + Arrays.asList( + PluginHelper.splitAndTrim(filters, ","))); + if (excludes != null) { + getLog().info("config - excludes " + excludes); + } + if (!StringUtils.isEmpty(fileInPattern)) { + getLog().info("config - fileInPattern " + fileInPattern); + } + if (!StringUtils.isEmpty(fileOutPattern)) { + getLog().info("config - fileOutPattern " + fileOutPattern); + } + if (overwrite) { + getLog().info("config - overwrite " + overwrite); + } + } +} Modified: trunk/processor-maven-plugin/src/site/apt/index.apt =================================================================== (Binary files differ)
participants (1)
-
tchemit@users.nuiton.org