r1853 - in trunk/src: main/java/org/nuiton/license/plugin site site/apt site/fr/apt
Author: tchemit Date: 2010-10-17 02:51:35 +0200 (Sun, 17 Oct 2010) New Revision: 1853 Url: http://nuiton.org/repositories/revision/maven-license-plugin/1853 Log: show extensions in comment-style-list goal update documentation Modified: trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java trunk/src/site/apt/index.apt trunk/src/site/apt/update-file-header-config.apt trunk/src/site/fr/apt/index.apt trunk/src/site/fr/apt/update-file-header-config.apt trunk/src/site/site_en.xml trunk/src/site/site_fr.xml Modified: trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-10-16 23:56:48 UTC (rev 1852) +++ trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-10-17 00:51:35 UTC (rev 1853) @@ -30,6 +30,7 @@ import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; @@ -79,13 +80,18 @@ Collections.sort(names); int maxLength = 0; + int maxDLength = 0; for (String name : names) { if (name.length() > maxLength) { maxLength = name.length(); } + FileHeaderTransformer transformer = transformers.get(name); + if (transformer.getDescription().length() > maxDLength) { + maxDLength = transformer.getDescription().length(); + } } - String pattern = " - %1$-" + maxLength + "s : %2$s\n"; + String pattern = " - %1$-" + maxLength + "s : %2$-" + maxDLength + "s, extensions : %3$s\n"; buffer.append("List of available comment styles:\n\n"); for (String transformerName : names) { @@ -93,7 +99,8 @@ transformers.get(transformerName); buffer.append(String.format(pattern, transformerName, - transformer.getDescription()) + transformer.getDescription(), + Arrays.toString(transformer.getDefaultAcceptedExtensions())) ); if (detail) { buffer.append("\n example : \n"); Modified: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt 2010-10-16 23:56:48 UTC (rev 1852) +++ trunk/src/site/apt/index.apt 2010-10-17 00:51:35 UTC (rev 1853) @@ -34,6 +34,30 @@ The process tags are separated by space otherwise plugin can NOT update header of this file! +What's new in version 2.4 et 2.4.1 + + We would like not to use any longer project description file since it is too + redundant. For that purpose we wrote a new scanning mode for the + update-file-header mojo which is automaticly fired when no project file + descriptor is found. + + The idea of this new mode is quite easy : Sepcify somme roots directories to scan. + For each of theses roots, if a file with a known extension is detected then + do the magic update of header. + + Some default values are offered : roots are : + <<src>>, <<target/generated-sources>> and <<target/processed-sources>>. + + It is also possible to specify includes and exlcudes files to treate on theses + roots by using <<includes>> and <<excludes>> parameters. + + List of all extensions can be found by invoking the <<comment-style-list>> goal. + + This new mode will replace the descriptor way in version 3 (says file + descriptor will disappear for good). + + For more information, see the new page {{{./update-file-header-config.html}Configure update-file-header goal}}. + What's new in version 2.3.1 Use {{{http://maven-site.nuiton.org/maven-helper-plugin}maven-helper-plugin 1.2.6}} Modified: trunk/src/site/apt/update-file-header-config.apt =================================================================== --- trunk/src/site/apt/update-file-header-config.apt 2010-10-16 23:56:48 UTC (rev 1852) +++ trunk/src/site/apt/update-file-header-config.apt 2010-10-17 00:51:35 UTC (rev 1853) @@ -40,8 +40,21 @@ * excludes: List of files to exclude, gived by a regexp (for example: <*Test.java>). The default excludes are i18n properties (**/i18n/*.properties). - The treated extensions are: java, xml, rst, properties and apt. + * extraExtensions: Dictionnary of extensions to map to existing comment style. + + To see all extensions accepted run the <<comment-style-list>> goal. +------------------------------------------------------------------------------- +[INFO] --- maven-license-plugin:2.4.1:comment-style-list (default-cli) @ maven-license-plugin --- +[INFO] List of available comment styles: + + - apt : header transformer with apt comment style , extensions : [apt] + - java : header transformer with java comment style , extensions : [java, groovy, css, cs, as, aj, c, h, cpp] + - properties : header transformer with properties file comment style, extensions : [properties, sh, py, rb, pl, pm] + - rst : header transformer with rst comment style , extensions : [rst] + - xml : header transformer with xml comment style , extensions : [pom, xml, xhtml, mxlm, dtd, jspx, fml, xsl, html, htm, jaxx, kml, gsp, tml] +------------------------------------------------------------------------------- + Roots By default, All the files in <src> are treated. This could be changed with the @@ -93,14 +106,13 @@ ------------------------------------------------------------------------------- Only files from src/main/java, src/test/java and src/test/resources will be treated. - Includes - Par défault, Tous les fichiers depuis le(s) roots et avec la bonne extension - sont traités. Avec le parametre de type Liste <includes>, il est possible de - spécifier avec plus de precision quels fichiers on désire traiter. + By default, all the files from the roots and with the adequate extension are treated. + With the list parameters <includes>, we can specify with more precision which + files we want to deals. -* Exemple +* Example Soit un pom avec la configuration de plugin suivante: @@ -137,19 +149,17 @@ ------------------------------------------------------------------------------- - Le goal update-file-header sera appliqué uniquement aux fichiers java (depuis - "src") dont le nom se termine par <"Dao"> ou <"Bean"> et aux fichiers xml contenant - <"entities"> dans leur nom. + The update-file-header will be done only on java files (from "src") ending with + <"Dao"> and <"Bean"> and on xml files containing <"entities"> in their file name. Excludes - Le parametre <excludes> permet d'ignorer certains fichiers lors du processus - update-file-header. + The excludes parameter allows to ignore some file in the update-file-header process. -* Exemple +* Example - Soit un pom avec la configuration de plugin suivante: + Given a pom with these plugin configuration ------------------------------------------------------------------------------- @@ -184,6 +194,34 @@ ------------------------------------------------------------------------------- - Les fichiers Java dont le nom se terminent par "Test", les fichiers png et txt - seront ignorés. + The java files ending with "Test", the png files and the txt files will be + ignored by the update-file-header goal. +ExtraExtensions + + To use more extensions, add a mapped parameter where keys are extensions and values + are the comment style type to use. + +* Exemple + + Soit un pom avec la configuration de plugin suivante: + +------------------------------------------------------------------------------- + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <version>2.4</version> + <configuration> + <extraExtensions> + <yo>java</java> + </extraExtensions> + </configuration> + </plugin> + </plugins> + +------------------------------------------------------------------------------- + + Files with <<yo>> extension will be treated as java files. + Modified: trunk/src/site/fr/apt/index.apt =================================================================== --- trunk/src/site/fr/apt/index.apt 2010-10-16 23:56:48 UTC (rev 1852) +++ trunk/src/site/fr/apt/index.apt 2010-10-17 00:51:35 UTC (rev 1853) @@ -36,6 +36,29 @@ Dans la documentation, les tags de process sont séparés par des espaces où le plugin ne pourrait PAS gérer la license de ces fichiers ! +Quoi de neuf dans la version 2.4 et 2.4.1 + + On voudrait ne plus utiliser les fichiers de descriptions d'en-tête introduits + précédemment. Pour ce faire, on ajoute un nouveau mode (qui est déclanché + automatiquement si un tel fichier n'est pas trouvé). + + Le principe est assez simple : on fournit un ou plusieurs répertoire source + (dit <<roots>>) à partir duquel on va scanner tous les fichiers. Pour tout + fichier dont l'extension est connu on met à jour l'en-tête si nécessaire. + + Dees valeurs par défaut sont prévues pour couvrir l'essentiel des cas : + <<src>>, <<target/generated-sources>> and <<target/processed-sources>>. + + Il est aussi possible d'include au excludes des répertoires via les + paramètres <<includes>> et <<excludes>>. + + La liste complête des extensions connues peuvent être trouvées en invoquant + le goal <<comment-style-list>> goal. + + Ce nouveau mode remplacera définitivement l'ancien mode en version 3. + + Pour plus d'information, consulter la nouvelle page {{{./update-file-header-config.html}Configurer le goal update-file-header}}. + Quoi de neuf dans la version 2.3.1 Utilisation de {{{http://maven-site.nuiton.org/maven-helper-plugin}maven-helper-plugin 1.2.6}} (amélioration de la gestion de l'encoding si aucun fournit). Modified: trunk/src/site/fr/apt/update-file-header-config.apt =================================================================== --- trunk/src/site/fr/apt/update-file-header-config.apt 2010-10-16 23:56:48 UTC (rev 1852) +++ trunk/src/site/fr/apt/update-file-header-config.apt 2010-10-17 00:51:35 UTC (rev 1853) @@ -27,7 +27,7 @@ ---- <Depuis la version 2.4>, en l'absence de fichier descriptor, il est possible de - configurer le goal update-file-header avec quatre four parametres: + configurer le goal update-file-header avec quatre paramètres: * licenseName : il s'agit du nom de la license à appliquer aux fichiers. Ce parametre est obligatoire, @@ -42,8 +42,23 @@ (par exemple: <*Test.java>). Par défault, les fichier "properties" de i18n (**/i18n/*.properties). - Les extensiosn traités sont: .java, .xml, .rst, .properties et .apt. + * extraExtensions : Dictionnaire d'extensions supplémentaires à traiter. + Pour connaitre la liste complêtes des extensions connues lancer le goal + <<comment-style-list>>. + +------------------------------------------------------------------------------- +[INFO] --- maven-license-plugin:2.4.1:comment-style-list (default-cli) @ maven-license-plugin --- +[INFO] List of available comment styles: + + - apt : header transformer with apt comment style , extensions : [apt] + - java : header transformer with java comment style , extensions : [java, groovy, css, cs, as, aj, c, h, cpp] + - properties : header transformer with properties file comment style, extensions : [properties, sh, py, rb, pl, pm] + - rst : header transformer with rst comment style , extensions : [rst] + - xml : header transformer with xml comment style , extensions : [pom, xml, xhtml, mxlm, dtd, jspx, fml, xsl, html, htm, jaxx, kml, gsp, tml] +------------------------------------------------------------------------------- + + Roots Par défault, tous les fichiers contenus dans <src> sont traités. Cela peut se @@ -99,11 +114,11 @@ Includes - By default, all the files from the roots and with the adequate extension are treated. - With the list parameters <includes>, we can specify with more precision which - files we want to deals. + Par défault, Tous les fichiers depuis le(s) roots et avec la bonne extension + sont traités. Avec le parametre de type Liste <includes>, il est possible de + spécifier avec plus de precision quels fichiers on désire traiter. -* Example +* Exemple Soit un pom avec la configuration de plugin suivante: @@ -140,17 +155,19 @@ ------------------------------------------------------------------------------- - The update-file-header will be done only on java files (from "src") ending with - <"Dao"> and <"Bean"> and on xml files containing <"entities"> in their file name. + Le goal update-file-header sera appliqué uniquement aux fichiers java (depuis + "src") dont le nom se termine par <"Dao"> ou <"Bean"> et aux fichiers xml contenant + <"entities"> dans leur nom. Excludes - The excludes parameter allows to ignore some file in the update-file-header process. + Le parametre <excludes> permet d'ignorer certains fichiers lors du processus + update-file-header. -* Example +* Exemple - Given a pom with these plugin configuration + Soit un pom avec la configuration de plugin suivante: ------------------------------------------------------------------------------- @@ -185,6 +202,36 @@ ------------------------------------------------------------------------------- - The java files ending with "Test", the png files and the txt files will be - ignored by the update-file-header goal. + Les fichiers Java dont le nom se terminent par "Test", les fichiers png et txt + seront ignorés. + + +ExtraExtensions + + Il est possible de spécifier des extensions supplémentaires à traiter en utilisant + le paramètre de type dictionnaire <<extraExtension>> où les clef sont les + extensions et les valeurs les type de commentaire à utiliser. + +* Exemple + + Soit un pom avec la configuration de plugin suivante: + +------------------------------------------------------------------------------- + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <version>2.4</version> + <configuration> + <extraExtensions> + <yo>java</java> + </extraExtensions> + </configuration> + </plugin> + </plugins> + +------------------------------------------------------------------------------- + + Les fichiers d'extension <<yo> seront traités comme des fichiers d'en-tête java. \ No newline at end of file Modified: trunk/src/site/site_en.xml =================================================================== --- trunk/src/site/site_en.xml 2010-10-16 23:56:48 UTC (rev 1852) +++ trunk/src/site/site_en.xml 2010-10-17 00:51:35 UTC (rev 1853) @@ -62,6 +62,7 @@ <item name="License" href="usage.html#License"> <item name="update-project-license" href="update-project-license-mojo.html"/> <item name="update-file-header" href="update-file-header-mojo.html"/> + <item name="configure update-file-header" href="update-file-header-config.html"/> </item> <item name="Third-party" href="usage.html#Third-party"> <item name="add-third-party" href="add-third-party-mojo.html"/> Modified: trunk/src/site/site_fr.xml =================================================================== --- trunk/src/site/site_fr.xml 2010-10-16 23:56:48 UTC (rev 1852) +++ trunk/src/site/site_fr.xml 2010-10-17 00:51:35 UTC (rev 1853) @@ -57,10 +57,11 @@ <item name="Introduction" href="index.html"/> <item name="Modèle de header de fichier" href="header.html"/> <item name="Descripteur de license du projet" href="descriptor.html"/> - <item name="Usage" href="usage.html"> + <item name="Utilisation" href="usage.html"> <item name="License" href="usage.html#License"> <item name="update-project-license" href="update-project-license-mojo.html"/> <item name="update-file-header" href="update-file-header-mojo.html"/> + <item name="configurer update-file-header" href="update-file-header-config.html"/> </item> <item name="Third-party" href="usage.html#Third-party"> <item name="add-third-party" href="add-third-party-mojo.html"/>
participants (1)
-
tchemit@users.nuiton.org