Author: tchemit Date: 2008-08-17 20:33:30 +0000 (Sun, 17 Aug 2008) New Revision: 1038 Added: trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/AvailableLicensesMojo.java Modified: trunk/maven-license-switcher-plugin/src/site/apt/index.apt trunk/maven-license-switcher-plugin/src/site/apt/usage.apt Log: goal pour connaitre les licences connues par le plugin Copied: trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/AvailableLicensesMojo.java (from rev 1031, trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/SwitchLicenseMojo.java) =================================================================== --- trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/AvailableLicensesMojo.java (rev 0) +++ trunk/maven-license-switcher-plugin/src/main/java/org/codelutin/license/AvailableLicensesMojo.java 2008-08-17 20:33:30 UTC (rev 1038) @@ -0,0 +1,40 @@ +/** + * *##% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * ##%* + */ +package org.codelutin.license; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; + +/** + * Le goal pour afficher dans la console les differentes licenses connus par le plugin (i.e les valeurs de l'enumeration + * {@link org.codelutin.license.LicenseType}). + * + * @author chemit + * @goal available-licenses + */ +public class AvailableLicensesMojo extends AbstractMojo { + + public void execute() throws MojoExecutionException, MojoFailureException { + StringBuilder sb = new StringBuilder(); + sb.append("Available licenses :\n"); + + for (LicenseType license : LicenseType.values()) { + sb.append(" * ").append(license).append('\n'); + } + System.out.println(sb.toString()); + } + +} \ No newline at end of file Modified: trunk/maven-license-switcher-plugin/src/site/apt/index.apt =================================================================== --- trunk/maven-license-switcher-plugin/src/site/apt/index.apt 2008-08-17 19:26:55 UTC (rev 1037) +++ trunk/maven-license-switcher-plugin/src/site/apt/index.apt 2008-08-17 20:33:30 UTC (rev 1038) @@ -17,8 +17,10 @@ * {{{switch-mojo.html}llicence-switcher:switch}} parse Java sources and switch licence header. - * {{{help-mojo.html}licence-switcher:help}} display help. + * {{{help-mojo.html}licence-switcher:help}} display help about the plugin (goals, usage). + * {{{help-mojo.html}licence-switcher:available-licenses}} display the known licenses of the plugin. + * Usage Instructions on how to use the Plugin can be found {{{usage.html}here}}. Modified: trunk/maven-license-switcher-plugin/src/site/apt/usage.apt =================================================================== --- trunk/maven-license-switcher-plugin/src/site/apt/usage.apt 2008-08-17 19:26:55 UTC (rev 1037) +++ trunk/maven-license-switcher-plugin/src/site/apt/usage.apt 2008-08-17 20:33:30 UTC (rev 1038) @@ -12,11 +12,29 @@ * The <<<switch>>> Mojo - The <<<switch>>> mojo is used to switch licence header on each java source files and add a LICENCE.txt file on the - basedir of the project. +The <<<switch>>> mojo is used to switch licence header on each java source files and add a LICENSE.txt file on the +basedir of the project. + By default, the license to apply is the lgpl v 3. To change it pass the maven parameter <<<-Dlicense-switcher.licenseType=ANOTHER LICENCE TYPE>>> + + +-----+ -mvn switch-licence:switch +mvn license-switcher:switch +-----+ -To be done. +* The <<<available-licenses>>> Mojo + +The <<<available-licenses>>> mojo display in the console the known licenses. + ++-----+ +mvn license-switcher:available-licenses ++-----+ + +* The <<<help>>> Mojo + +The <<<help>>> mojo display in the console the help for the plugin. + ++-----+ +mvn license-switcher:help ++-----+ +