Author: tchemit Date: 2009-04-20 10:50:39 +0000 (Mon, 20 Apr 2009) New Revision: 1430 Added: maven-license-switcher-plugin/trunk/src/site/rst/ maven-license-switcher-plugin/trunk/src/site/rst/Todo.rst maven-license-switcher-plugin/trunk/src/site/rst/index.rst Modified: maven-license-switcher-plugin/trunk/changelog.txt maven-license-switcher-plugin/trunk/pom.xml maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/LicenseGenerator.java maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/AbstractLicensePlugin.java maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/AvailableLicensesPlugin.java maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/LicensePlugin.java maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/SwitchLicensePlugin.java maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/ThirdPartyPlugin.java maven-license-switcher-plugin/trunk/src/test/java/org/codelutin/license/plugin/BasePluginTestCase.java maven-license-switcher-plugin/trunk/src/test/java/org/codelutin/license/plugin/impl/LicensePluginTest.java Log: bump versions, clean code, use doxia-module-jrst Modified: maven-license-switcher-plugin/trunk/changelog.txt =================================================================== --- maven-license-switcher-plugin/trunk/changelog.txt 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/changelog.txt 2009-04-20 10:50:39 UTC (rev 1430) @@ -1,4 +1,5 @@ 0.6 chemit 20090218 + * 20090420 [chemit] clean code, use latest versions, use doxia-module-jrst instead of maven-jrst-plugin * 20090217 [chemit] use project.build.sourceEncoding instead of maven.compile.encoding as default encoding * 20081210 [chemit] use lutinproject 3.4 Modified: maven-license-switcher-plugin/trunk/pom.xml =================================================================== --- maven-license-switcher-plugin/trunk/pom.xml 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/pom.xml 2009-04-20 10:50:39 UTC (rev 1430) @@ -9,7 +9,7 @@ <parent> <groupId>org.codelutin</groupId> <artifactId>lutinproject</artifactId> - <version>3.4</version> + <version>3.5.3</version> </parent> <artifactId>maven-license-switcher-plugin</artifactId> @@ -35,7 +35,7 @@ <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-dependency-tree</artifactId> - <version>1.1</version> + <version>1.2</version> </dependency> <!-- tests dependencies --> @@ -89,9 +89,9 @@ <labs.project>lutinutil</labs.project> <processor.version>0.17</processor.version> - <lutinpluginutil.version>0.3</lutinpluginutil.version> + <lutinpluginutil.version>0.4</lutinpluginutil.version> - <maven.version>2.0.9</maven.version> + <maven.version>2.0.10</maven.version> </properties> @@ -104,7 +104,6 @@ <!-- plugin plugin --> <plugin> <artifactId>maven-plugin-plugin</artifactId> - <version>2.4.3</version> <executions> <execution> <goals> @@ -137,21 +136,20 @@ </execution> </executions> </plugin> - <!-- Always process jrst files, but only called on pre-site phase --> + <!-- plugin site --> <plugin> - <groupId>org.codelutin</groupId> - <artifactId>maven-jrst-plugin</artifactId> - <version>0.8.4</version> + <artifactId>maven-site-plugin</artifactId> <configuration> - <defaultLocale>fr</defaultLocale> + <locales>fr</locales> + <siteDirectory>src/site</siteDirectory> </configuration> - <executions> - <execution> - <goals> - <goal>jrst</goal> - </goals> - </execution> - </executions> + <dependencies> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>doxia-module-jrst</artifactId> + <version>1.0.0</version> + </dependency> + </dependencies> </plugin> </plugins> </build> Modified: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/LicenseGenerator.java =================================================================== --- maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/LicenseGenerator.java 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/LicenseGenerator.java 2009-04-20 10:50:39 UTC (rev 1430) @@ -1,7 +1,5 @@ package org.codelutin.license; -import java.io.File; - /** * A simple Contract to generate a new header for a given type of file * Modified: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/AbstractLicensePlugin.java =================================================================== --- maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/AbstractLicensePlugin.java 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/AbstractLicensePlugin.java 2009-04-20 10:50:39 UTC (rev 1430) @@ -106,6 +106,7 @@ */ protected File pomFile; + @Override public void execute() throws MojoExecutionException, MojoFailureException { try { Modified: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/AvailableLicensesPlugin.java =================================================================== --- maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/AvailableLicensesPlugin.java 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/AvailableLicensesPlugin.java 2009-04-20 10:50:39 UTC (rev 1430) @@ -41,6 +41,7 @@ */ protected String extraResolver; + @Override public void execute() throws MojoExecutionException, MojoFailureException { StringBuilder sb = new StringBuilder(); sb.append("Available licenses :\n"); Modified: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/LicensePlugin.java =================================================================== --- maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/LicensePlugin.java 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/LicensePlugin.java 2009-04-20 10:50:39 UTC (rev 1430) @@ -68,6 +68,7 @@ return project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging())); } + @Override protected boolean init() throws Exception { // must generate if file does not exist @@ -90,6 +91,7 @@ return doGenerate; } + @Override protected void doAction() throws Exception { getLog().info("using licence [" + licenseName + "]"); @@ -124,40 +126,6 @@ } } - /*@Override - public void execute() throws MojoExecutionException, MojoFailureException { - - super.execute(); - - if (doGenerate) { - - getLog().info("using licence [" + licenseName + "]"); - - if (verbose) { - getLog().info("licence : " + license); - } - - if (licenseFile.exists() && keepBackup) { - if (verbose) { - getLog().info("backup " + licenseFile); - } - // copy it to backup file - File backup = new File(licenseFile.getAbsolutePath() + "~"); - licenseFile.renameTo(backup); - } - try { - FileUtil.writeString(licenseFile, license.getLicenseContent(encoding), encoding); - - } catch (IOException e) { - throw new MojoExecutionException("could not write license file " + licenseFile + " for reason : " + e.getMessage(), e); - } - } - - // copy LICENSE.txt to classpath - copyFileToOutputDirectory(licenseFile); - }*/ - - public File getLicenseFile() { return licenseFile; } Modified: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/SwitchLicensePlugin.java =================================================================== --- maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/SwitchLicensePlugin.java 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/SwitchLicensePlugin.java 2009-04-20 10:50:39 UTC (rev 1430) @@ -138,6 +138,7 @@ return "pom".equals(project.getPackaging()) || "site".equals(project.getPackaging()); } + @Override protected boolean init() throws IOException { boolean doGenerate = force; @@ -184,34 +185,6 @@ } } - /*@Override - public void execute() throws MojoExecutionException, MojoFailureException { - - super.execute(); - - - - if (javaFilesToTreate.isEmpty()) { - getLog().warn("no java source files found to be treated."); - return; - } - - // create a licence processor with given header - LicenseProcessor p = new LicenseProcessor(licenseHeaderContent); - - for (Entry<File, String[]> entry : javaFilesToTreate.entrySet()) { - File src = entry.getKey(); - for (String javaRelativePath : entry.getValue()) { - File sourceFile = new File(src, javaRelativePath); - try { - processJavaSource(p, sourceFile); - } catch (Exception e) { - throw new MojoExecutionException("could not treate java source file " + sourceFile + " for reason : " + e.getMessage(), e); - } - } - } - }*/ - protected Map<File, String[]> getFilesToTreate() { // init directory scanner Modified: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/ThirdPartyPlugin.java =================================================================== --- maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/ThirdPartyPlugin.java 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/impl/ThirdPartyPlugin.java 2009-04-20 10:50:39 UTC (rev 1430) @@ -129,6 +129,7 @@ return "pom".equals(project.getPackaging()) || "site".equals(project.getPackaging()); } + @Override protected boolean init() throws Exception { boolean doGenerate = false; @@ -184,31 +185,6 @@ } } - /*@Override - public void execute() throws MojoExecutionException, MojoFailureException { - - super.execute(); - - if (doGenerate) { - if (verbose) { - getLog().info("writing third-party file : " + thirdPartyFile); - } - if (keepBackup && thirdPartyFile.exists()) { - if (verbose) { - getLog().info("backup " + thirdPartyFile); - } - thirdPartyFile.renameTo(new File(thirdPartyFile.getAbsolutePath() + '~')); - } - try { - FileUtil.writeString(thirdPartyFile, thirdPartyFileContent, encoding); - } catch (IOException e) { - throw new MojoExecutionException("could not write file " + thirdPartyFile + " for reason : " + e.getMessage(), e); - } - } - - }*/ - - /** @return resolve the dependency tree */ protected DependencyNode resolveProject() { try { Copied: maven-license-switcher-plugin/trunk/src/site/rst/Todo.rst (from rev 1387, maven-license-switcher-plugin/trunk/src/site/fr/rst/Todo.rst) =================================================================== --- maven-license-switcher-plugin/trunk/src/site/rst/Todo.rst (rev 0) +++ maven-license-switcher-plugin/trunk/src/site/rst/Todo.rst 2009-04-20 10:50:39 UTC (rev 1430) @@ -0,0 +1,4 @@ +TODO +==== + +Any idea ? Property changes on: maven-license-switcher-plugin/trunk/src/site/rst/Todo.rst ___________________________________________________________________ Name: svn:mergeinfo + Copied: maven-license-switcher-plugin/trunk/src/site/rst/index.rst (from rev 1387, maven-license-switcher-plugin/trunk/src/site/fr/rst/index.rst) =================================================================== --- maven-license-switcher-plugin/trunk/src/site/rst/index.rst (rev 0) +++ maven-license-switcher-plugin/trunk/src/site/rst/index.rst 2009-04-20 10:50:39 UTC (rev 1430) @@ -0,0 +1,45 @@ +Introduction +------------ + +Maven license-switcher Plugin +============================= + +The Maven License Switcher Plugin is used to switch the license on java sources of a maven module. + +Goals Overview +~~~~~~~~~~~~~~ + +The plugin has the following goals: + + * `license-switcher license`_ add license file and third-party files to classpath (generate them if necessary). + + * `license-switcher third-party`_ write the licenses of all third-party libraries used in project. + + * `license-switcher switch`_ parse Java sources and switch license header. + + * `license-switcher help`_ display help about the plugin (goals, usage). + + * `license-switcher available-licenses`_ display the known licenses of the plugin. + +Usage +~~~~~ + + Instructions on how to use the Plugin can be found on `usage page`_ + +Examples +~~~~~~~~ + + to be done. + +.. _license-switcher license: license-mojo.html + +.. _license-switcher third-party: third-party-mojo.html + +.. _license-switcher switch: switch-mojo.html + +.. _license-switcher help: help-mojo.html + +.. _license-switcher available-licenses: available-licenses-mojo.html + +.. _usage page: usage.html + \ No newline at end of file Modified: maven-license-switcher-plugin/trunk/src/test/java/org/codelutin/license/plugin/BasePluginTestCase.java =================================================================== --- maven-license-switcher-plugin/trunk/src/test/java/org/codelutin/license/plugin/BasePluginTestCase.java 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/src/test/java/org/codelutin/license/plugin/BasePluginTestCase.java 2009-04-20 10:50:39 UTC (rev 1430) @@ -1,6 +1,5 @@ package org.codelutin.license.plugin; -import org.apache.commons.logging.Log; import org.apache.maven.plugin.Mojo; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.junit.Before; @@ -77,7 +76,7 @@ } - private static class MyAbstractMojoTestCase extends AbstractMojoTestCase { + public static class MyAbstractMojoTestCase extends AbstractMojoTestCase { @Override public Mojo lookupMojo(String goal, File pom) throws Exception { Modified: maven-license-switcher-plugin/trunk/src/test/java/org/codelutin/license/plugin/impl/LicensePluginTest.java =================================================================== --- maven-license-switcher-plugin/trunk/src/test/java/org/codelutin/license/plugin/impl/LicensePluginTest.java 2009-04-20 10:50:35 UTC (rev 1429) +++ maven-license-switcher-plugin/trunk/src/test/java/org/codelutin/license/plugin/impl/LicensePluginTest.java 2009-04-20 10:50:39 UTC (rev 1430) @@ -28,6 +28,7 @@ } @Before + @Override public void setUp() throws Exception { super.setUp(); LicensePlugin plugin = (LicensePlugin) mojo;