Author: chatellier Date: 2008-11-14 09:28:19 +0000 (Fri, 14 Nov 2008) New Revision: 371 Added: maven-generator-plugin/tags/maven-generator-plugin-0.61/ maven-generator-plugin/tags/maven-generator-plugin-0.61/pom.xml maven-generator-plugin/tags/maven-generator-plugin-0.61/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java Removed: maven-generator-plugin/tags/maven-generator-plugin-0.61/pom.xml maven-generator-plugin/tags/maven-generator-plugin-0.61/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java Log: [maven-release-plugin] copy for tag maven-generator-plugin-0.61 Copied: maven-generator-plugin/tags/maven-generator-plugin-0.61 (from rev 363, maven-generator-plugin/trunk) Deleted: maven-generator-plugin/tags/maven-generator-plugin-0.61/pom.xml =================================================================== --- maven-generator-plugin/trunk/pom.xml 2008-11-07 16:56:41 UTC (rev 363) +++ maven-generator-plugin/tags/maven-generator-plugin-0.61/pom.xml 2008-11-14 09:28:19 UTC (rev 371) @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<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/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - <parent> - <groupId>org.codelutin</groupId> - <artifactId>lutinpluginproject</artifactId> - <version>3.0</version> - </parent> - - <artifactId>maven-generator-plugin</artifactId> - - <!-- POM Relationships : Inheritance : Dependencies --> - <dependencies> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>lutingenerator</artifactId> - <version>0.61-SNAPSHOT</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>lutinpluginutil</artifactId> - <version>0.2</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant</artifactId> - <version>1.7.1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant-trax</artifactId> - <version>1.7.1</version> - <scope>runtime</scope> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - <name>Plugin maven Generator</name> - <version>0.61-SNAPSHOT</version> - <inceptionYear>2006</inceptionYear> - <description>maven plugin to use the lutingenerator library</description> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - <packaging>maven-plugin</packaging> - - <properties> - <!-- id du projet du labs --> - <labs.id>39</labs.id> - - <!-- nom du projet sur le labs --> - <labs.project>lutingenerator</labs.project> - - </properties> - - <build> - <plugins> - - </plugins> - </build> - - - <!-- ************************************************************* --> - <!-- *** Build Environment ************************************** --> - <!-- ************************************************************* --> - - <!--Source control management--> - <scm> - <connection>${maven.scm.connection}</connection> - <developerConnection>${maven.scm.developerConnection}</developerConnection> - <url>${maven.scm.url}</url> - </scm> - -</project> Copied: maven-generator-plugin/tags/maven-generator-plugin-0.61/pom.xml (from rev 370, maven-generator-plugin/trunk/pom.xml) =================================================================== --- maven-generator-plugin/tags/maven-generator-plugin-0.61/pom.xml (rev 0) +++ maven-generator-plugin/tags/maven-generator-plugin-0.61/pom.xml 2008-11-14 09:28:19 UTC (rev 371) @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinpluginproject</artifactId> + <version>3.0</version> + </parent> + + <artifactId>maven-generator-plugin</artifactId> + + <!-- POM Relationships : Inheritance : Dependencies --> + <dependencies> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>lutingenerator</artifactId> + <version>0.61</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>lutinpluginutil</artifactId> + <version>0.2</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + <version>1.7.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant-trax</artifactId> + <version>1.7.1</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Plugin maven Generator</name> + <version>0.61</version> + <inceptionYear>2006</inceptionYear> + <description>maven plugin to use the lutingenerator library</description> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + <packaging>maven-plugin</packaging> + + <properties> + <!-- id du projet du labs --> + <labs.id>39</labs.id> + + <!-- nom du projet sur le labs --> + <labs.project>lutingenerator</labs.project> + + </properties> + + <build> + <plugins> + + </plugins> + </build> + + + <!-- ************************************************************* --> + <!-- *** Build Environment ************************************** --> + <!-- ************************************************************* --> + + <!--Source control management--> + <scm> + <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/maven-generator-plugin-0.61</connection> + <developerConnection>scm:svn:svn+ssh://chatellier@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/maven-generator-plugin-0.61</developerConnection> + <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/maven-generator-plugin/tags/maven-generator-plugin-0.61?root=lutingenerator</url> + </scm> + +</project> Deleted: maven-generator-plugin/tags/maven-generator-plugin-0.61/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java =================================================================== --- maven-generator-plugin/trunk/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java 2008-11-07 16:56:41 UTC (rev 363) +++ maven-generator-plugin/tags/maven-generator-plugin-0.61/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java 2008-11-14 09:28:19 UTC (rev 371) @@ -1,186 +0,0 @@ -/* *##% Plugin maven Generator - * Copyright (C) 2006 - 2008 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>. ##%*/ - -/* * - * GeneratorPlugin.java - * - * Created: 14 avril 2006 - * - * @author ruchaud - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ - -package org.codelutin.generator.plugin; - -import org.apache.maven.model.Resource; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; -import org.apache.tools.ant.BuildLogger; -import org.apache.tools.ant.NoBannerLogger; -import org.apache.tools.ant.Project; -import org.codelutin.generator.GeneratorTask; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -/** - * Effectue toutes les générations et copie les fichiers générés - * dans le répertoire de compilation - * - * @goal generate - */ -public class GeneratorPlugin extends AbstractMojo { - - /** - * @description Dépendance du projet. - * @parameter default-value="${project}" - * @readonly - */ - protected MavenProject project; - - /** - * Répertoire source - * - * @parameter alias="srcGenDest" - * @required - */ - protected File srcDirGen; - - /** - * Répertoire cible - * - * @parameter - * @required - */ - protected File destDirGen; - - /** - * Templates à utiliser, séparés par des virgules - * - * @parameter - * @required - */ - protected String templates; - - /** - * Templates à ne pas utiliser - * - * @parameter - */ - protected List<String> excludeTemplates; - - - /** - * Fichier à inclure - * - * @parameter - * @required - */ - protected String includes; - - /** - * Nom par défaut du paquetage généré - * - * @parameter expression="org.codelutin.${project.artifactId}" - */ - protected String defaultPackage; - - /** - * Ecrase les fichiers générés - * - * @parameter default-value="false" - */ - private boolean overwrite = false; - - public void execute() throws MojoExecutionException, MojoFailureException { - getLog().info("Effectue toutes les générations et copie les fichiers générés " - + "dans le répertoire de compilation"); - - /* Création d'un projet ant */ - Project project = new Project(); - - BuildLogger logger = new NoBannerLogger(); - logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO); - logger.setOutputPrintStream(System.out); - logger.setErrorPrintStream(System.err); - - project.init(); - project.getBaseDir(); - project.addBuildListener(logger); - - /* Création de la tâche ant */ - GeneratorTask generator = new GeneratorTask(); - generator.setProject(project); - generator.setTaskName("Generator"); - - /* Configuration */ - generator.setOverwrite(overwrite); - - generator.setTemplates(templates); - - generator.setSrcdir(srcDirGen); - - destDirGen.mkdirs(); - generator.setDestdir(destDirGen); - - fixCompileSourceRoots(); - - generator.setProperties("defaultPackage=" + defaultPackage); - - generator.setIncludes(includes); - generator.setExcludeTemplates(excludeTemplates==null?java.util.Collections.<String>emptyList():excludeTemplates); - - /* Execution */ - generator.execute(); - } - - /** - * permet d'ajout le répertoire de génération des fichiers java dans les répertoires - * de compilation du projet Maven. - */ - protected void fixCompileSourceRoots() { - - if (!project.getCompileSourceRoots().contains(destDirGen.getPath())) { - getLog().info("add compile source root : " + destDirGen); - project.addCompileSourceRoot(destDirGen.getPath()); - Resource resources = new Resource(); - resources.setDirectory(destDirGen.getAbsolutePath()); - resources.setExcludes(Arrays.asList("**/*.java")); - getLog().info("add resource root :" + resources); - project.addResource(resources); - } - - // Ajout aussi dans le classpath des tests - // car si la generation s'effectue en phase : generate-test-sources - // il ne trouve pas les fichiers générés - if (!project.getTestCompileSourceRoots().contains(destDirGen.getPath())) { - getLog().info("add test compile source root : " + destDirGen); - project.addTestCompileSourceRoot(destDirGen.getPath()); - Resource resources = new Resource(); - resources.setDirectory(destDirGen.getAbsolutePath()); - resources.setExcludes(Arrays.asList("**/*.java")); - getLog().info("add test resource root :" + resources); - project.addTestResource(resources); - } - } -} Copied: maven-generator-plugin/tags/maven-generator-plugin-0.61/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java (from rev 369, maven-generator-plugin/trunk/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java) =================================================================== --- maven-generator-plugin/tags/maven-generator-plugin-0.61/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java (rev 0) +++ maven-generator-plugin/tags/maven-generator-plugin-0.61/src/main/java/org/codelutin/generator/plugin/GeneratorPlugin.java 2008-11-14 09:28:19 UTC (rev 371) @@ -0,0 +1,185 @@ +/* *##% Plugin maven Generator + * Copyright (C) 2006 - 2008 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>. ##%*/ + +/* * + * GeneratorPlugin.java + * + * Created: 14 avril 2006 + * + * @author ruchaud + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ + +package org.codelutin.generator.plugin; + +import org.apache.maven.model.Resource; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.tools.ant.BuildLogger; +import org.apache.tools.ant.NoBannerLogger; +import org.apache.tools.ant.Project; +import org.codelutin.generator.GeneratorTask; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +/** + * Effectue toutes les générations et copie les fichiers générés + * dans le répertoire de compilation + * + * @goal generate + */ +public class GeneratorPlugin extends AbstractMojo { + + /** + * @description Dépendance du projet. + * @parameter default-value="${project}" + * @readonly + */ + protected MavenProject project; + + /** + * Répertoire source + * + * @parameter alias="srcGenDest" + * @required + */ + protected File srcDirGen; + + /** + * Répertoire cible + * + * @parameter + * @required + */ + protected File destDirGen; + + /** + * Templates à utiliser, séparés par des virgules + * + * @parameter + * @required + */ + protected String templates; + + /** + * Templates à ne pas utiliser + * + * @parameter + */ + protected List<String> excludeTemplates; + + /** + * Fichier à inclure + * + * @parameter + * @required + */ + protected String includes; + + /** + * Nom par défaut du paquetage généré + * + * @parameter expression="org.codelutin.${project.artifactId}" + */ + protected String defaultPackage; + + /** + * Ecrase les fichiers générés + * + * @parameter default-value="false" + */ + private boolean overwrite = false; + + public void execute() throws MojoExecutionException, MojoFailureException { + getLog().info("Effectue toutes les générations et copie les fichiers générés " + + "dans le répertoire de compilation"); + + /* Création d'un projet ant */ + Project project = new Project(); + + BuildLogger logger = new NoBannerLogger(); + logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO); + logger.setOutputPrintStream(System.out); + logger.setErrorPrintStream(System.err); + + project.init(); + project.getBaseDir(); + project.addBuildListener(logger); + + /* Création de la tâche ant */ + GeneratorTask generator = new GeneratorTask(); + generator.setProject(project); + generator.setTaskName("Generator"); + + /* Configuration */ + generator.setOverwrite(overwrite); + + generator.setTemplates(templates); + + generator.setSrcdir(srcDirGen); + + destDirGen.mkdirs(); + generator.setDestdir(destDirGen); + + fixCompileSourceRoots(); + + generator.setProperties("defaultPackage=" + defaultPackage); + + generator.setIncludes(includes); + generator.setExcludeTemplates(excludeTemplates==null?java.util.Collections.<String>emptyList():excludeTemplates); + + /* Execution */ + generator.execute(); + } + + /** + * permet d'ajout le répertoire de génération des fichiers java dans les répertoires + * de compilation du projet Maven. + */ + protected void fixCompileSourceRoots() { + + if (!project.getCompileSourceRoots().contains(destDirGen.getPath())) { + getLog().info("add compile source root : " + destDirGen); + project.addCompileSourceRoot(destDirGen.getPath()); + Resource resources = new Resource(); + resources.setDirectory(destDirGen.getAbsolutePath()); + resources.setExcludes(Arrays.asList("**/*.java")); + getLog().info("add resource root :" + resources); + project.addResource(resources); + } + + // Ajout aussi dans le classpath des tests + // car si la generation s'effectue en phase : generate-test-sources + // il ne trouve pas les fichiers générés + if (!project.getTestCompileSourceRoots().contains(destDirGen.getPath())) { + getLog().info("add test compile source root : " + destDirGen); + project.addTestCompileSourceRoot(destDirGen.getPath()); + Resource resources = new Resource(); + resources.setDirectory(destDirGen.getAbsolutePath()); + resources.setExcludes(Arrays.asList("**/*.java")); + getLog().info("add test resource root :" + resources); + project.addTestResource(resources); + } + } +}