Author: tchemit Date: 2010-04-10 17:37:33 +0200 (Sat, 10 Apr 2010) New Revision: 1733 Log: - continue documentation - remove license header (for test purpose...) - finish tests Added: trunk/src/it/update-project-license/ trunk/src/it/update-project-license/LICENSE.txt trunk/src/it/update-project-license/README.txt trunk/src/it/update-project-license/changelog.txt trunk/src/it/update-project-license/invoker.properties trunk/src/it/update-project-license/pom.xml trunk/src/it/update-project-license/src/ trunk/src/it/update-project-license/src/license/ trunk/src/it/update-project-license/src/license/project.xml trunk/src/it/update-project-license/src/main/ trunk/src/it/update-project-license/src/main/java/ trunk/src/it/update-project-license/src/main/java/org/ trunk/src/it/update-project-license/src/main/java/org/nuiton/ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java trunk/src/it/update-project-license/verify.groovy trunk/src/license/ trunk/src/license/project.xml trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java trunk/src/site/rst/actions.rst trunk/src/site/rst/deprecated-mojos.rst trunk/src/site/rst/get-informations.rst trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml Removed: trunk/src/it/add-license-file/ Modified: trunk/pom.xml trunk/src/it/update-license/pom.xml trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java trunk/src/main/java/org/nuiton/license/plugin/model/License.java trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java trunk/src/main/mdo/descriptor.mdo trunk/src/site/rst/descriptor.rst trunk/src/site/rst/header.rst trunk/src/site/rst/index.rst trunk/src/site/rst/usage.rst trunk/src/site/site_en.xml trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testOne.xml trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testTwo.xml trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/bug_28.xml trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/java.xml trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/properties.xml trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/xml.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/pom.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -297,11 +297,11 @@ <properties> <processor.version>1.0.2</processor.version> - - <!-- TODO Remove this when mavenpom greater than 2.8 --> + + <!-- TODO Remove this when mavenpom greater than 2.1 --> <helper.version>1.2.3-SNAPSHOT</helper.version> - <!-- version of project license descriptor model --> + <!-- version of project license descriptor model --> <mdoVersion>1.0.0</mdoVersion> <!-- documentation is in english --> @@ -452,6 +452,12 @@ <profile> <id>run-its</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> <build> <defaultGoal>integration-test</defaultGoal> <plugins> Modified: trunk/src/it/update-license/pom.xml =================================================================== --- trunk/src/it/update-license/pom.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/it/update-license/pom.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -10,14 +10,14 @@ <!-- ************************************************************* --> <groupId>org.nuiton.license.test</groupId> - <artifactId>test-update-header-file</artifactId> + <artifactId>test-update-license</artifactId> <version>@pom.version@</version> <!-- ************************************************************* --> <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>License Test :: update-header-file</name> + <name>License Test :: update-license</name> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> Added: trunk/src/it/update-project-license/LICENSE.txt =================================================================== --- trunk/src/it/update-project-license/LICENSE.txt (rev 0) +++ trunk/src/it/update-project-license/LICENSE.txt 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,167 @@ +;; This line will be removed! + 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. + Property changes on: trunk/src/it/update-project-license/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/README.txt =================================================================== --- trunk/src/it/update-project-license/README.txt (rev 0) +++ trunk/src/it/update-project-license/README.txt 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,2 @@ +To test parserJava on a new project (says a project with no i18n translations) +At the end we should have in target/generated-sources/i18n getters detected. Property changes on: trunk/src/it/update-project-license/README.txt ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/changelog.txt =================================================================== --- trunk/src/it/update-project-license/changelog.txt (rev 0) +++ trunk/src/it/update-project-license/changelog.txt 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1 @@ +see the changelog of org.nuiton:i18n project. \ No newline at end of file Property changes on: trunk/src/it/update-project-license/changelog.txt ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/invoker.properties =================================================================== --- trunk/src/it/update-project-license/invoker.properties (rev 0) +++ trunk/src/it/update-project-license/invoker.properties 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,21 @@ +# A comma or space separated list of goals/phases to execute, may +# specify an empty list to execute the default goal of the IT project +invoker.goals=clean process-resources + +# Optionally, a list of goals to run during further invocations of Maven +#invoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:run + +# A comma or space separated list of profiles to activate +#invoker.profiles=run-all run-once + +# The value for the environment variable MAVEN_OPTS +#invoker.mavenOpts=-Dfile.encoding=UTF-16 -Xms32m -Xmx256m + +# Possible values are "fail-fast" (default), "fail-at-end" and "fail-never" +invoker.failureBehavior=fail-at-end + +# The expected result of the build, possible values are "success" (default) and "failure" +#invoker.buildResult=success + +# A boolean value controlling the -N flag, defaults to "false" +#invoker.nonRecursive=false Property changes on: trunk/src/it/update-project-license/invoker.properties ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/pom.xml =================================================================== --- trunk/src/it/update-project-license/pom.xml (rev 0) +++ trunk/src/it/update-project-license/pom.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,63 @@ +<?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 *************************************** --> + <!-- ************************************************************* --> + + <groupId>org.nuiton.license.test</groupId> + <artifactId>test-update-project-license</artifactId> + <version>@pom.version@</version> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>License Test :: update-project-license</name> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>jar</packaging> + + <inceptionYear>2012</inceptionYear> + + <organization> + <name>License Test</name> + </organization> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <build> + + <plugins> + + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <version>@pom.version@</version> + <configuration> + <verbose>true</verbose> + <generateBundle>true</generateBundle> + <bundleLicensePath>META-INF/bundleLicense.txt</bundleLicensePath> + </configuration> + <executions> + <execution> + <id>first</id> + <goals> + <goal>update-project-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> + + Property changes on: trunk/src/it/update-project-license/pom.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/src/license/project.xml =================================================================== --- trunk/src/it/update-project-license/src/license/project.xml (rev 0) +++ trunk/src/it/update-project-license/src/license/project.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,19 @@ +<?xml version='1.0' encoding='UTF-8'?> +<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd"> + <mainLicense>gpl_v3</mainLicense> + <licenseSets> + <licenseSet> + <fileSets> + <fileSet> + <headerType>java</headerType> + <basedir>src/main/java</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + </fileSets> + </licenseSet> + </licenseSets> +</project> Property changes on: trunk/src/it/update-project-license/src/license/project.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java =================================================================== --- trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java (rev 0) +++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,10 @@ +package org.nuiton.license.plugin.test; + +/** + * this class has no license, a new default one will be added. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class MyBean { +} Property changes on: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java =================================================================== --- trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java (rev 0) +++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,20 @@ +/* + * #%L + * License Test :: do NOT update! + * %% + * Copyright (C) 2010 Tony + * %% + * Fake to be removed! + * #L% + */ + +/** + * this class owns a header, only license will be updated. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +package org.nuiton.license.plugin.test; + +public class MyBean2 { +} Property changes on: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java =================================================================== --- trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java (rev 0) +++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,18 @@ +/* + * %%Ignore-License + * + * yet another license + * + * Copyright (C) 2000 Codelutin Do not update! + */ + +/** + * this class owns a ignore license header and will not be updated. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +package org.nuiton.license.plugin.test; + +public class MyBean3 { +} Property changes on: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/it/update-project-license/verify.groovy =================================================================== --- trunk/src/it/update-project-license/verify.groovy (rev 0) +++ trunk/src/it/update-project-license/verify.groovy 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,43 @@ + +file = new File(basedir, 'LICENSE.txt'); +assert file.exists(); + +content = file.text; +assert !content.contains( ';; This line will be removed!' ); +assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' ); +assert content.contains( 'GNU GENERAL PUBLIC LICENSE' ); + +file = new File(basedir, 'target/generated-sources/license/LICENSE.txt'); +assert file.exists(); + +content = file.text; +assert !content.contains( ';; This line will be removed!' ); +assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' ); +assert content.contains( 'GNU GENERAL PUBLIC LICENSE' ); + +file = new File(basedir, 'target/generated-sources/license/META-INF/bundleLicense.txt'); +assert file.exists(); + +content = file.text; +assert !content.contains( ';; This line will be removed!' ); +assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' ); +assert content.contains( 'GNU GENERAL PUBLIC LICENSE' ); + +file = new File(basedir, 'target/classes/LICENSE.txt'); +assert file.exists(); + +content = file.text; +assert !content.contains( ';; This line will be removed!' ); +assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' ); +assert content.contains( 'GNU GENERAL PUBLIC LICENSE' ); + + +file = new File(basedir, 'target/classes/META-INF/bundleLicense.txt'); +assert file.exists(); + +content = file.text; +assert !content.contains( ';; This line will be removed!' ); +assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' ); +assert content.contains( 'GNU GENERAL PUBLIC LICENSE' ); + +return true; Property changes on: trunk/src/it/update-project-license/verify.groovy ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/license/project.xml =================================================================== --- trunk/src/license/project.xml (rev 0) +++ trunk/src/license/project.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,53 @@ +<?xml version='1.0' encoding='UTF-8'?> +<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd"> + <mainLicense>lgpl_v3</mainLicense> + <licenseSets> + <licenseSet> + <fileSets> + + <fileSet> + <headerType>java</headerType> + <basedir>src/main/java</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + + <fileSet> + <headerType>java</headerType> + <basedir>src/test/java</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + + <fileSet> + <headerType>java</headerType> + <basedir>src/target/generated-sources/modello</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + + <fileSet> + <headerType>rst</headerType> + <basedir>src/site</basedir> + <includes> + <include>**/*.rst</include> + </includes> + </fileSet> + + <fileSet> + <headerType>xml</headerType> + <basedir>src/site</basedir> + <includes> + <include>**/*.xml</include> + </includes> + </fileSet> + + </fileSets> + </licenseSet> + </licenseSets> +</project> Property changes on: trunk/src/license/project.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -94,4 +94,8 @@ return store; } + protected boolean hasClassPath() { + return rejectPackaging(Packaging.pom); + } + } Added: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java (rev 0) +++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,310 @@ +package org.nuiton.license.plugin; + +import org.apache.commons.lang.StringUtils; +import org.apache.maven.plugin.MojoFailureException; +import org.nuiton.license.plugin.header.FileHeader; +import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer; +import org.nuiton.license.plugin.model.License; +import org.nuiton.license.plugin.model.LicenseStore; +import org.nuiton.license.plugin.model.project.FileSet; +import org.nuiton.license.plugin.model.project.LicenseProject; +import org.nuiton.license.plugin.model.project.LicenseSet; +import org.nuiton.license.plugin.model.project.io.xpp3.LicenseProjectXpp3Reader; + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.*; + +/** + * Abstract mojo which using {@link #descriptor} file and owns a + * {@link #licenseStore}. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public abstract class AbstractLicenseWithDescriptorMojo extends AbstractLicenseMojo { + + /** + * The project license descriptor file. + * + * @parameter expression="${license.descriptor}" default-value="src/license/project.xml" + * @required + * @since 2.1 + */ + private File descriptor; + + /** + * To specify an external extra licenses repository resolver (says the base + * url of the repository where the {@code license.properties} is present). + * + * @parameter expression="${license.licenseResolver}" + * @since 2.1 + */ + private String licenseResolver; + + /** + * A flag to keep a backup of every modified file. + * + * @parameter expression="${license.keepBackup}" default-value="false" + * @since 2.1 + */ + private boolean keepBackup; + + /** + * All available header transformers. + * + * @component role="org.nuiton.license.plugin.header.transformer.FileHeaderTransformer" + * @since 2.1 + */ + private Map<String, FileHeaderTransformer> transformers; + + /** store of licenses */ + private LicenseStore licenseStore; + + /** descriptor of project */ + private LicenseProject licenseProject; + + /** @return {@code true} if goal will not be executed */ + public abstract boolean isSkip(); + + /** + * Changes internal state {@code skip} to execute (or not) goal. + * + * @param skip new state value + */ + public abstract void setSkip(boolean skip); + + @Override + protected boolean checkSkip() { + if (isSkip()) { + getLog().info("skip flag is on, will skip goal."); + return false; + } + return super.checkSkip(); + } + + @Override + protected void init() throws Exception { + + if (isSkip()) { + return; + } + + // init licenses store + LicenseStore licenseStore = createLicenseStore(getLicenseResolver()); + setLicenseStore(licenseStore); + + // load project descriptor + LicenseProject licenseProject = null; + FileReader reader = new FileReader(getDescriptor()); + try { + licenseProject = new LicenseProjectXpp3Reader().read(reader); + setLicenseProject(licenseProject); + } finally { + reader.close(); + } + + // check that license project is sane (known licenses + header types) + // + populate default license name in LicenseSet (with main License) if + // none given for licenseSet + validateProjectFile(licenseProject, + licenseStore, + getTransformers() + ); + } + + public File getDescriptor() { + return descriptor; + } + + public boolean isKeepBackup() { + return keepBackup; + } + + public Map<String, FileHeaderTransformer> getTransformers() { + return transformers; + } + + public String getLicenseResolver() { + return licenseResolver; + } + + public LicenseStore getLicenseStore() { + return licenseStore; + } + + public LicenseProject getLicenseProject() { + return licenseProject; + } + + public void setKeepBackup(boolean keepBackup) { + this.keepBackup = keepBackup; + } + + public void setDescriptor(File descriptor) { + this.descriptor = descriptor; + } + + public void setLicenseResolver(String licenseResolver) { + this.licenseResolver = licenseResolver; + } + + public void setTransformers(Map<String, FileHeaderTransformer> transformers) { + this.transformers = transformers; + } + + public void setLicenseStore(LicenseStore licenseStore) { + this.licenseStore = licenseStore; + } + + + public void setLicenseProject(LicenseProject licenseProject) { + this.licenseProject = licenseProject; + } + + public License getMainLicense() + throws IllegalArgumentException, IllegalStateException { + LicenseProject licenseProject = getLicenseProject(); + if (licenseProject == null) { + throw new IllegalStateException("No license project initialized!"); + } + String mainLicenseName = licenseProject.getMainLicense(); + if (StringUtils.isEmpty(mainLicenseName)) { + throw new IllegalArgumentException( + "main license name can not be null, nor empty"); + } + License mainLicense = getLicense(mainLicenseName); + return mainLicense; + } + + public License getLicense(String licenseName) + throws IllegalArgumentException, IllegalStateException { + if (StringUtils.isEmpty(licenseName)) { + throw new IllegalArgumentException("licenseName can not be null, nor empty"); + } + LicenseStore licenseStore = getLicenseStore(); + if (licenseStore == null) { + throw new IllegalStateException("No license store initialized!"); + } + License mainLicense = licenseStore.getLicense(licenseName); + return mainLicense; + } + + public FileHeaderTransformer getTransformer(String transformerName) + throws IllegalArgumentException, IllegalStateException { + if (StringUtils.isEmpty(transformerName)) { + throw new IllegalArgumentException("transformerName can not be null, nor empty!"); + } + Map<String, FileHeaderTransformer> transformers = getTransformers(); + if (transformers == null) { + throw new IllegalStateException("No transformers initialized!"); + } + FileHeaderTransformer transformer = + transformers.get(transformerName); + return transformer; + } + + /** + * Build a default header given the parameters. + * + * @param license the license type ot use in header + * @param projectName project name as header description + * @param inceptionYear first year of copyright + * @param copyrightHolder holder of copyright + * @param encoding encoding used to read or write files + * @param addSvnKeyWords a flag to add in description section svn keywords + * @return the new file header + * @throws IOException if any problem while creating file header + */ + protected FileHeader buildDefaultFileHeader( + License license, + String projectName, + String inceptionYear, + String copyrightHolder, + boolean addSvnKeyWords, + String encoding) throws IOException { + FileHeader result = new FileHeader(); + + StringBuilder buffer = new StringBuilder(); + buffer.append(projectName); + if (addSvnKeyWords) { + // add svn keyworks + char ls = FileHeaderTransformer.LINE_SEPARATOR; + buffer.append(ls); + + // breaks the keyword otherwise svn will update them here + buffer.append(ls).append("$" + "Author$"); + buffer.append(ls).append("$" + "LastChangedDate$"); + buffer.append(ls).append("$" + "LastChangedRevision$"); + buffer.append(ls).append("$" + "Id$"); + buffer.append(ls).append("$" + "HeadURL$"); + + } + result.setDescription(buffer.toString()); + if (getLog().isDebugEnabled()) { + getLog().debug("header description : " + result.getDescription()); + } + + String licenseContent = license.getHeaderContent(encoding); + result.setLicense(licenseContent); + + Integer firstYear = Integer.valueOf(inceptionYear); + result.setCopyrightFirstYear(firstYear); + + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + Integer lastYear = cal.get(Calendar.YEAR); + if (firstYear < lastYear) { + result.setCopyrightLastYear(lastYear); + } + result.setCopyrightHolder(copyrightHolder); + return result; + } + + protected void validateProjectFile( + LicenseProject licenseProject, + LicenseStore licenseStore, + Map<String, FileHeaderTransformer> transformers) + throws MojoFailureException { + + List<String> licenseNames = Arrays.asList(licenseStore.getLicenseNames()); + + // check licenses is known + String mainLicense = licenseProject.getMainLicense(); + if (licenseStore.getLicense(mainLicense) == null) { + throw new MojoFailureException( + "main license '" + mainLicense + + "' is unknown, use one of " + licenseNames); + } + for (LicenseSet licenseSet : licenseProject.getLicenseSets()) { + + String licenseName = licenseSet.getLicenseName(); + if (StringUtils.isEmpty(licenseName)) { + + // use the main license + licenseSet.setLicenseName(mainLicense); + } else { + + // check license name + if (licenseStore.getLicense(licenseName) == null) { + throw new MojoFailureException( + "license '" + licenseName + + "' is unknown, use one of " + licenseNames); + } + } + + // check header types (for each file set) + for (FileSet fileSet : licenseSet.getFileSets()) { + String headerType = fileSet.getHeaderType(); + + if (getTransformer(headerType) == null) { + throw new MojoFailureException( + "headerType '" + headerType + + "' is unknown, use one of " + transformers.keySet()); + } + } + } + } + +} Property changes on: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.nuiton.license.plugin.model.License; @@ -16,7 +15,9 @@ * @phase generate-resources * @requiresProject true * @requiresDependencyResolution compile + * @deprecated since 2.1, prefer use now the goal {@code update-project-license}. */ +@Deprecated public class AddLicenseFileMojo extends AbstractLicenseMojo { /** @@ -84,7 +85,7 @@ * Cette option n'est utilisable que sur des modules avec un class-path (pas * pour un pom) * - * @parameter expression="${license.copyToMETA_INF}" default-value="false" + * @parameter expression="${license.generateBundle}" default-value="false" * @since 1.0.0 */ protected boolean copyToMETA_INF; @@ -99,20 +100,11 @@ protected License license; - protected boolean hasClassPath() { - return rejectPackaging(Packaging.pom); - } - boolean doGenerate; @Override protected void init() throws Exception { - if (getLog().isDebugEnabled()) { - // always be verbose in debug mode - setVerbose(true); - } - // must generate if file does not exist doGenerate = true; Modified: trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.apache.maven.artifact.Artifact; @@ -77,7 +76,7 @@ * Un flag pour faire une copie nommé dans META-INF (prefixe avec le nom de * l'artifact). * - * @parameter expression="${license.copyToMETA_INF}" default-value="false" + * @parameter expression="${license.generateBundle}" default-value="false" * @since 1.0.0 */ protected boolean copyToMETA_INF; @@ -159,7 +158,7 @@ // always be verbose in debug mode setVerbose(true); } - + doGenerate = true; thirdPartyFile = new File(outputDirectory, thirdPartyFilename); Modified: trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.apache.maven.plugin.MojoExecutionException; Modified: trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.apache.maven.plugin.MojoExecutionException; Modified: trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.apache.maven.plugin.MojoExecutionException; @@ -40,7 +39,7 @@ @Override protected void init() throws Exception { - + // obtain licenses store licenseStore = createLicenseStore(extraResolver); } Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.apache.maven.plugin.MojoExecutionException; Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,22 +1,16 @@ - package org.nuiton.license.plugin; import org.apache.commons.lang.StringUtils; -import org.apache.maven.plugin.MojoFailureException; import org.nuiton.license.plugin.header.FileHeader; import org.nuiton.license.plugin.header.FileHeaderFilter; import org.nuiton.license.plugin.header.FileHeaderProcessor; import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer; import org.nuiton.license.plugin.model.License; -import org.nuiton.license.plugin.model.LicenseStore; import org.nuiton.license.plugin.model.project.FileSet; -import org.nuiton.license.plugin.model.project.LicenseProject; import org.nuiton.license.plugin.model.project.LicenseSet; -import org.nuiton.license.plugin.model.project.io.xpp3.LicenseProjectXpp3Reader; import org.nuiton.plugin.PluginHelper; import java.io.File; -import java.io.FileReader; import java.io.IOException; import java.util.*; @@ -35,18 +29,9 @@ * @goal update-license * @since 2.1 */ -public class UpdateLicenseMojo extends AbstractLicenseMojo { +public class UpdateLicenseMojo extends AbstractLicenseWithDescriptorMojo { /** - * The project license descriptor file. - * - * @parameter expression="${license.descriptor}" default-value="src/license/project.xml" - * @required - * @since 2.1 - */ - protected File descriptor; - - /** * Name of project (or module). * <p/> * Will be used as description section of new header. @@ -80,7 +65,10 @@ protected String inceptionYear; /** - * A flag to add svn:keywors on new header. + * A flag to add svn:keywords on new header. + * <p/> + * Will add svn keywords : + * <pre>Author, Id, Rev, URL and Date</pre> * * @parameter expression="${license.addSvnKeyWords}" default-value="false" * @since 2.1 @@ -100,30 +88,15 @@ * A tag to place on files that will be ignored by the plugin. * <p/> * Sometimes, it is necessary to do this when file is under a specific license. + * <p/> + * <b>Note:</b> If no sets, will use the default tag {@code %}%Ignore-License * - * @parameter expression="${license.ignoreTag}" default-value="%%Ignore-License" + * @parameter expression="${license.ignoreTag}" * @since 2.1 */ protected String ignoreTag; /** - * To specify an external extra licenses repository resolver (says the base - * url of the repository where the {@code license.properties} is present). - * - * @parameter expression="${license.licenseResolver}" - * @since 2.1 - */ - protected String licenseResolver; - - /** - * A flag to keep a backup of every modified file. - * - * @parameter expression="${license.keepBackup}" default-value="false" - * @since 2.1 - */ - protected boolean keepBackup; - - /** * A flag to skip the goal. * * @parameter expression="${license.skipUpdateLicense}" default-value="false" @@ -139,55 +112,34 @@ */ protected boolean dryRun; - /** - * All available header transformers. - * - * @component role="org.nuiton.license.plugin.header.transformer.FileHeaderTransformer" - * @since 2.1 - */ - protected Map<String, FileHeaderTransformer> transformers; - /** timestamp used for generation */ protected long timestamp; - /** store of licenses */ - protected LicenseStore licenseStore; - - /** descriptor of project */ - protected LicenseProject licenseProject; - /** set of processed files */ protected Set<File> processedFiles; @Override - protected boolean checkSkip() { - if (skipUpdateLicense) { - getLog().info("skip flag is on, will skip goal."); - return false; - } - return super.checkSkip(); - } - - @Override public void init() throws Exception { - if (getLog().isDebugEnabled()) { - // always be verbose in debug mode - setVerbose(true); + if (isSkip()) { + return; } - if (isSkipUpdateLicense()) { - return; + if (StringUtils.isEmpty(getIgnoreTag())) { + + // use default value + setIgnoreTag("%" + "%Ignore-License"); } if (isVerbose()) { + + // print availables comment styles (transformers) StringBuilder buffer = new StringBuilder(); buffer.append("config - available comment styles :"); String commentFormat = "\n * %1$s (%2$s)"; - for (Map.Entry<String, FileHeaderTransformer> e : - transformers.entrySet()) { - Map.Entry<String, FileHeaderTransformer> next = e; - FileHeaderTransformer transformer = next.getValue(); + for (String transformerName : getTransformers().keySet()) { + FileHeaderTransformer transformer = + getTransformer(transformerName); String str = String.format(commentFormat, transformer.getName(), transformer.getDescription() @@ -210,21 +162,7 @@ // set timestamp used for temporary files setTimestamp(System.nanoTime()); - // init licenses store - licenseStore = createLicenseStore(licenseResolver); - - // load project descriptor - FileReader reader = new FileReader(getDescriptor()); - try { - licenseProject = new LicenseProjectXpp3Reader().read(reader); - } finally { - reader.close(); - } - - // check that license project is sane (known licenses + header types) - // + populate default license name in LicenseSet (with main License) if - // none given for licenseSet - validateProjectFile(licenseProject, licenseStore, transformers); + super.init(); } @Override @@ -246,11 +184,11 @@ processedFiles = new HashSet<File>(); - for (LicenseSet licenseSet : licenseProject.getLicenseSets()) { + for (LicenseSet licenseSet : getLicenseProject().getLicenseSets()) { // obtain license from definition String licenseName = licenseSet.getLicenseName(); - License license = licenseStore.getLicense(licenseName); + License license = getLicense(licenseName); if (isVerbose()) { getLog().info("process " + license.getDescription()); @@ -262,6 +200,7 @@ getProjectName(), getInceptionYear(), getOrganizationName(), + isAddSvnKeyWords(), getEncoding() ); @@ -296,8 +235,7 @@ ); // get header transformer according to file set - FileHeaderTransformer transformer = - transformers.get(fileSet.getHeaderType()); + FileHeaderTransformer transformer = getTransformer(fileSet.getHeaderType()); // change transformer in processor processor.setTransformer(transformer); @@ -370,7 +308,7 @@ //check that file is not marked to be ignored if (content.contains(getIgnoreTag())) { - getLog().info("ignore file (using " + getIgnoreTag() + ")"); + getLog().info("ignore file (detected " + getIgnoreTag() + ") " + file); deleteFile(processFile); return; @@ -402,7 +340,7 @@ protected void finalizeFile(File file, File processFile) throws IOException { if (isKeepBackup() && !isDryRun()) { - File backupFile = new File(file.getAbsolutePath() + "~"); + File backupFile = getBackupFile(file); if (backupFile.exists()) { @@ -432,10 +370,6 @@ return timestamp; } - private File getDescriptor() { - return descriptor; - } - public String getProjectName() { return projectName; } @@ -456,30 +390,32 @@ return ignoreTag; } - public boolean isKeepBackup() { - return keepBackup; - } - public boolean isDryRun() { return dryRun; } - public boolean isSkipUpdateLicense() { + @Override + public boolean isSkip() { return skipUpdateLicense; } + @Override + public void setSkip(boolean skipUpdateLicense) { + this.skipUpdateLicense = skipUpdateLicense; + } + public Set<File> getProcessedFiles() { return processedFiles; } + public boolean isAddSvnKeyWords() { + return addSvnKeyWords; + } + public void setDryRun(boolean dryRun) { this.dryRun = dryRun; } - public void setKeepBackup(boolean keepBackup) { - this.keepBackup = keepBackup; - } - public void setTimestamp(long timestamp) { this.timestamp = timestamp; } @@ -500,7 +436,6 @@ this.organizationName = organizationName; } - public void setUpdateCopyright(boolean updateCopyright) { this.updateCopyright = updateCopyright; } @@ -509,102 +444,11 @@ this.ignoreTag = ignoreTag; } - protected void validateProjectFile( - LicenseProject licenseProject, - LicenseStore licenseStore, - Map<String, FileHeaderTransformer> transformers) - throws MojoFailureException { - - List<String> licenseNames = Arrays.asList(licenseStore.getLicenseNames()); - - // check licenses is known - String mainLicense = licenseProject.getMainLicense(); - if (licenseStore.getLicense(mainLicense) == null) { - throw new MojoFailureException( - "main license '" + mainLicense + - "' is unknown, use one of " + licenseNames); - } - for (LicenseSet licenseSet : licenseProject.getLicenseSets()) { - - String licenseName = licenseSet.getLicenseName(); - if (StringUtils.isEmpty(licenseName)) { - - // use the main license - licenseSet.setLicenseName(mainLicense); - } else { - - // check license name - if (licenseStore.getLicense(licenseName) == null) { - throw new MojoFailureException( - "license '" + licenseName + - "' is unknown, use one of " + licenseNames); - } - } - - // check header types (for each file set) - for (FileSet fileSet : licenseSet.getFileSets()) { - String headerType = fileSet.getHeaderType(); - if (!transformers.containsKey(headerType)) { - throw new MojoFailureException( - "headerType '" + headerType + - "' is unknown, use one of " + transformers.keySet()); - } - } - } + public void setAddSvnKeyWords(boolean addSvnKeyWords) { + this.addSvnKeyWords = addSvnKeyWords; } - /** - * Build a default header given the parameters. - * - * @param license the license type ot use in header - * @param projectName project name as header description - * @param inceptionYear first year of copyright - * @param copyrightHolder holder of copyright - * @param encoding encoding used to read or write files - * @return the new file header - * @throws IOException if any problem while creating file header - */ - protected FileHeader buildDefaultFileHeader( - License license, - String projectName, - String inceptionYear, - String copyrightHolder, - String encoding) throws IOException { - FileHeader result = new FileHeader(); - StringBuilder buffer = new StringBuilder(); - buffer.append(projectName); - if (addSvnKeyWords) { - // add svn keyworks - buffer.append(FileHeaderTransformer.LINE_SEPARATOR); - buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$Author$"); - buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$LastChangedDate$"); - buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$LastChangedRevision$"); - buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$Id$"); - buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$HeadURL$"); - - } - result.setDescription(buffer.toString()); - if (getLog().isDebugEnabled()) { - getLog().debug("header description : " + result.getDescription()); - } - - String licenseContent = license.getHeaderContent(encoding); - result.setLicense(licenseContent); - - Integer firstYear = Integer.valueOf(inceptionYear); - result.setCopyrightFirstYear(firstYear); - - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - Integer lastYear = cal.get(Calendar.YEAR); - if (firstYear < lastYear) { - result.setCopyrightLastYear(lastYear); - } - result.setCopyrightHolder(copyrightHolder); - return result; - } - public class UpdateLicenseHeaderFilter extends FileHeaderFilter { protected final boolean updateCopyright; Added: trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java (rev 0) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,222 @@ +package org.nuiton.license.plugin; + +import org.nuiton.license.plugin.model.License; +import org.nuiton.plugin.PluginHelper; + +import java.io.File; + +/** + * Updates (or creates) the main project license file according to the given + * license project {@link #descriptor}. + * <p/> + * Can also generate a bundle license file (to avoid collision names in + * class-path). This file is by default generate in + * {@code META-INF class-path directory}. + * <p/> + * <b>Note:</b> this goal replace {@code add-license} one (which does not + * use license project descriptor). + * + * @author tchemit <chemit@codelutin.com> + * @goal update-project-license + * @phase generate-resources + * @requiresProject true + * @since 2.1 + */ +public class UpdateProjectLicenseMojo extends AbstractLicenseWithDescriptorMojo { + + /** + * Project license file to synchronize with main license defined in + * descriptor file. + * + * @parameter expression="${license.licenceFile}" default-value="${basedir}/LICENSE.txt" + * @required + * @since 2.1 + */ + protected File licenseFile; + + /** + * The directory where to generate license resources. + * <p/> + * <b>Note:</b> This option is not available for {@code pom} module types. + * + * @parameter expression="${license.outputDirectory}" default-value="target/generated-sources/license" + * @since 2.1 + */ + protected File outputDirectory; + + /** + * A flag to copy the main license file in a bundled place. + * <p/> + * This is usefull for final application to have a none confusing location + * to seek for the application license. + * <p/> + * If Sets to {@code true}, will copy the license file to the + * {@link #bundleLicensePath} to {@link #outputDirectory}. + * <p/> + * <b>Note:</b> This option is not available for {@code pom} module types. + * + * @parameter expression="${license.generateBundle}" default-value="false" + * @since 2.1 + */ + protected boolean generateBundle; + + /** + * The path of the bundled license file to produce when + * {@link #generateBundle} is on. + * <p/> + * <b>Note:</b> This option is not available for {@code pom} module types. + * + * @parameter expression="${license.bundleLicensePath}" default-value="META-INF/${project.artifactId}-LICENSE.txt" + * @since 2.1 + */ + protected String bundleLicensePath; + + /** + * A flag to force to generate project license file even if it is up-to-date. + * + * @parameter expression="${license.force}" default-value="false" + * @since 1.0.0 + */ + protected boolean force; + + /** + * A flag to skip the goal. + * + * @parameter expression="${license.skipUpdateProjectLicense}" default-value="false" + * @since 2.1 + */ + protected boolean skipUpdateProjectLicense; + + /** flag to known if */ + protected boolean doGenerate; + + @Override + protected void init() throws Exception { + + if (isSkip()) { + return; + } + + super.init(); + + // must generate if file does not exist or pom never thant license file + File licenseFile = getLicenseFile(); + if (licenseFile != null) { + setDoGenerate(isForce() || !isFileNewerThanPomFile(licenseFile)); + } + } + + @Override + protected void doAction() throws Exception { + + License mainLicense = getMainLicense(); + + File target = getLicenseFile(); + + if (isDoGenerate()) { + + getLog().info("Will create or update license file [" + + mainLicense.getName() + "] to " + target); + if (isVerbose()) { + getLog().info("detail of license :\n" + mainLicense); + } + + if (target.exists() && isKeepBackup()) { + if (isVerbose()) { + getLog().info("backup " + target); + } + // copy it to backup file + backupFile(target); + } + } + + // obtain license content + String licenseContent = mainLicense.getLicenseContent(getEncoding()); + + if (isDoGenerate()) { + + // writes it root main license file + writeFile(target, licenseContent, getEncoding()); + } + + if (hasClassPath()) { + + // copy LICENSE.txt to the resource directory (to be include in + // class-path) + File resourceTarget = new File(getOutputDirectory(), target.getName()); + + copyFile(getLicenseFile(), resourceTarget); + + if (isGenerateBundle()) { + + // creates the bundled license file + File bundleTarget = PluginHelper.getFile( + getOutputDirectory(), + getBundleLicensePath() + ); + copyFile(target, bundleTarget); + } + + // add resources directory as project resources basedir + addResourceDir(getOutputDirectory(), "**/*.txt"); + } + } + + public File getLicenseFile() { + return licenseFile; + } + + public boolean isGenerateBundle() { + return generateBundle; + } + + public File getOutputDirectory() { + return outputDirectory; + } + + public String getBundleLicensePath() { + return bundleLicensePath; + } + + public boolean isDoGenerate() { + return doGenerate; + } + + public boolean isForce() { + return force; + } + + @Override + public boolean isSkip() { + return skipUpdateProjectLicense; + } + + public void setLicenseFile(File licenseFile) { + this.licenseFile = licenseFile; + } + + public void setGenerateBundle(boolean generateBundle) { + this.generateBundle = generateBundle; + } + + public void setOutputDirectory(File outputDirectory) { + this.outputDirectory = outputDirectory; + } + + public void setBundleLicensePath(String bundleLicensePath) { + this.bundleLicensePath = bundleLicensePath; + } + + public void setDoGenerate(boolean doGenerate) { + this.doGenerate = doGenerate; + } + + @Override + public void setSkip(boolean skipUpdateProjectLicense) { + this.skipUpdateProjectLicense = skipUpdateProjectLicense; + } + + public void setForce(boolean force) { + this.force = force; + } +} Property changes on: trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header; /** Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header; import org.apache.commons.logging.Log; @@ -98,4 +97,4 @@ detectHeader = false; state = State.SEARCH_HEADER; } -} \ No newline at end of file +} Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header; import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer; @@ -106,7 +105,7 @@ } return fullHeaderContent; } - + // public FileHeader getHeader() { // return header; // } Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.generator; import org.nuiton.license.plugin.header.FileHeader; Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.generator; import org.nuiton.license.plugin.header.FileHeader; Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.generator; import org.nuiton.license.plugin.header.FileHeader; Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.generator; import org.nuiton.license.plugin.header.FileHeader; Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.generator; import org.nuiton.license.plugin.header.FileHeader; Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.generator; import org.nuiton.license.plugin.header.FileHeader; Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.transformer; import org.nuiton.license.plugin.header.FileHeader; @@ -55,10 +54,6 @@ /** comment line prefix (to add for header content) */ protected String commentLinePrefix; - protected AbstractFileHeaderTransformer() { - - } - protected AbstractFileHeaderTransformer(String name, String description, String commentStartTag, @@ -71,14 +66,6 @@ this.commentLinePrefix = commentLinePrefix; } - protected AbstractFileHeaderTransformer(String commentStartTag, - String commentEndTag, - String commentLinePrefix) { - this.commentStartTag = commentStartTag; - this.commentEndTag = commentEndTag; - this.commentLinePrefix = commentLinePrefix; - } - @Override public String getName() { return name; Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.transformer; /** Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.transformer; import org.nuiton.license.plugin.header.FileHeader; @@ -29,13 +28,13 @@ String ROLE_NAME = FileHeaderTransformer.class.getName(); /** default section delimiter */ - String DEFAULT_SECTION_DELIMITER = "%%"; + String DEFAULT_SECTION_DELIMITER = "%" + "%"; /** default process start tag */ - String DEFAULT_PROCESS_START_TAG = "#%L"; + String DEFAULT_PROCESS_START_TAG = "#" + "%" + "L"; /** default process end tag */ - String DEFAULT_PROCESS_END_TAG = "#L%"; + String DEFAULT_PROCESS_END_TAG = "#" + "L" + "%"; char LINE_SEPARATOR = '\n'; @@ -78,49 +77,19 @@ */ String getSectionDelimiter(); + /** @return the start tag of a comment */ String getCommentStartTag(); + /** @return the end tag of a comment */ String getCommentEndTag(); + /** @return the line prefix of every line insed the comment */ String getCommentLinePrefix(); - void setName(String name); - - void setDescription(String description); - /** - * Sets the header section delimiter. - * <p/> - * By default, will use the {@link #DEFAULT_SECTION_DELIMITER}. - * - * @param headerSectionDelimiter the new delimiter - */ - void setSectionDelimiter(String headerSectionDelimiter); - - /** - * Changes the process start tag. - * - * @param tag the new start tag - */ - void setProcessStartTag(String tag); - - /** - * Changes the process end tag. - * - * @param tag the new endtag - */ - void setProcessEndTag(String tag); - - void setCommentStartTag(String commentStartTag); - - void setCommentEndTag(String commentEndTag); - - void setCommentLinePrefix(String commentLinePrefix); - - /** * Box the given {@code header} in a comment. * - * @param header the header content WITHOUT any comment boxing + * @param header the header content WITHOUT any comment boxing * @param withTags flag to add start and end comment tags. * @return the header content WITH comment boxing */ @@ -170,4 +139,62 @@ * @return the UNBOXED header content */ String toString(FileHeader model); + + /** + * Changes the name of the transformer. + * + * @param name the new name of the transformer + */ + void setName(String name); + + /** + * Chages the description of the transformer. + * + * @param description the new description of the transformer + */ + void setDescription(String description); + + /** + * Sets the header section delimiter. + * <p/> + * By default, will use the {@link #DEFAULT_SECTION_DELIMITER}. + * + * @param headerSectionDelimiter the new delimiter + */ + void setSectionDelimiter(String headerSectionDelimiter); + + /** + * Changes the process start tag. + * + * @param tag the new start tag + */ + void setProcessStartTag(String tag); + + /** + * Changes the process end tag. + * + * @param tag the new endtag + */ + void setProcessEndTag(String tag); + + /** + * Changes the comment start tag. + * + * @param commentStartTag the new comment start tag + */ + void setCommentStartTag(String commentStartTag); + + /** + * Changes the comment end tag. + * + * @param commentEndTag the new comment end tag + */ + void setCommentEndTag(String commentEndTag); + + /** + * Changes the comment prefix line. + * + * @param commentLinePrefix the new comment prefix line + */ + void setCommentLinePrefix(String commentLinePrefix); } Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.transformer; /** @@ -28,4 +27,4 @@ COMMENT_LINE_PREFIX ); } -} \ No newline at end of file +} Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.transformer; /** @@ -28,4 +27,4 @@ COMMENT_LINE_PREFIX ); } -} \ No newline at end of file +} Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -13,11 +13,11 @@ public static final String DESCRIPTION = "header transformer with rst comment style"; - public static final String COMMENT_LINE_PREFIX = " "; + public static final String COMMENT_LINE_PREFIX = ".. "; public static final String COMMENT_START_TAG = ".. "; - public static final String COMMENT_END_TAG = ""; + public static final String COMMENT_END_TAG = ".. "; public RstFileHeaderTransformer() { super(NAME, @@ -27,4 +27,4 @@ COMMENT_LINE_PREFIX ); } -} \ No newline at end of file +} Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.transformer; /** @@ -28,4 +27,4 @@ COMMENT_LINE_PREFIX ); } -} \ No newline at end of file +} Modified: trunk/src/main/java/org/nuiton/license/plugin/model/License.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/model/License.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/model/License.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.model; import org.apache.commons.lang.builder.ToStringBuilder; Modified: trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.model; import org.apache.commons.logging.Log; Modified: trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.model; import org.apache.commons.logging.Log; Modified: trunk/src/main/mdo/descriptor.mdo =================================================================== --- trunk/src/main/mdo/descriptor.mdo 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/main/mdo/descriptor.mdo 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,5 +1,30 @@ <?xml version="1.0"?> +<!-- + #%L + Maven License Plugin + $Author$ + $LastChangedDate$ + $LastChangedRevision$ + $Id$ + $HeadURL$ + %% + Copyright (C) 2008 - 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% + --> <model xsd.namespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" xsd.targetNamespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"> Added: trunk/src/site/rst/actions.rst =================================================================== --- trunk/src/site/rst/actions.rst (rev 0) +++ trunk/src/site/rst/actions.rst 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,57 @@ +======== +Actions! +======== + + +:Author: Tony Chemit <chemit@codelutin.com> +:Abstract: Describes action goals + +.. contents:: + :depth: 2 + +.. #%L +.. Maven License Plugin +.. +.. $Author: tchemit $ +.. $LastChangedDate$ +.. $LastChangedRevision$ +.. $Id$ +.. $HeadURL$ +.. %% +.. Copyright (C) 2008 - 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% + +Content +------- + +This page describes action goals which interacts with your project source files. + +The plugin has the following action goals: + + * `update-project-license`_ adds or updates license project file (since 2.1). + + * `update-license`_ adds or updates license header on some files (since 2.1). + + * `add-third-party`_ creates the THIRD-PARTY.txt in the build. + + +.. _update-project-license: update-project-license-mojo.html + +.. _update-license: update-license-mojo.html + +.. _add-third-party: add-third-party-mojo.html + Property changes on: trunk/src/site/rst/actions.rst ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/site/rst/deprecated-mojos.rst =================================================================== --- trunk/src/site/rst/deprecated-mojos.rst (rev 0) +++ trunk/src/site/rst/deprecated-mojos.rst 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,53 @@ +================ +Deprecated mojos +================ + + +:Author: Tony Chemit <chemit@codelutin.com> +:Abstract: Describes deprecated mojos since 2.1 + +.. contents:: + :depth: 2 + +.. #%L +.. Maven License Plugin +.. +.. $Author: tchemit $ +.. $LastChangedDate$ +.. $LastChangedRevision$ +.. $Id$ +.. $HeadURL$ +.. %% +.. Copyright (C) 2008 - 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% + +Content +------- + +This page describes deprectaed mojos since version **2.1**. + +The plugin has the following deprecated goals: + + * `add-license`_ add (and creates it if not found) the LICENSE.txt in the build + * `update-header`_ add or update license header on some files + * `generator-list`_ display list of available generators + +.. _add-license: add-license-mojo.html + +.. _update-header: update-header-mojo.html + +.. _generator-list: generator-list-mojo.html Property changes on: trunk/src/site/rst/deprecated-mojos.rst ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/site/rst/descriptor.rst =================================================================== --- trunk/src/site/rst/descriptor.rst 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/site/rst/descriptor.rst 2010-04-10 15:37:33 UTC (rev 1733) @@ -10,6 +10,32 @@ :start: 1 :depth: 2 +.. #%L +.. Maven License Plugin +.. +.. $Author$ +.. $LastChangedDate$ +.. $LastChangedRevision$ +.. $Id$ +.. $HeadURL$ +.. %% +.. Copyright (C) 2008 - 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% + Abstract ======== @@ -18,7 +44,7 @@ The license file descriptor file aims to enumerate all files to include in license process per type and license. -This new format is used in goal `update-license`_. +This new format is used in goal `update-license`_ and `update-project-license`_. TODO-TC-20100409 Do this documentation @@ -28,7 +54,7 @@ This file is ruled by a `xsd file`_. Example -------- +======= The next example applies a gpl v3 license on all java files in **src/main/java**. @@ -56,6 +82,8 @@ .. _update-license: update-license-mojo.html +.. _update-project-license: update-project-license-mojo.html + .. _comment-style-list: comment-style-list-mojo.html .. _xsd file: licenseProject-1.0.0.xsd \ No newline at end of file Added: trunk/src/site/rst/get-informations.rst =================================================================== --- trunk/src/site/rst/get-informations.rst (rev 0) +++ trunk/src/site/rst/get-informations.rst 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,54 @@ +================= +Get informations! +================= + +:Author: Tony Chemit <chemit@codelutin.com> +:Abstract: Describes information goals + +.. contents:: + :depth: 2 + +.. #%L +.. Maven License Plugin +.. +.. $Author: tchemit $ +.. $LastChangedDate$ +.. $LastChangedRevision$ +.. $Id$ +.. $HeadURL$ +.. %% +.. Copyright (C) 2008 - 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% + +Content +------- + +This page describes information goals which display in console some helpfull +informations to build your license project descriptor file. + +The plugin has the following information goals: + + * `comment-style-list`_ display list of available comment style header (since 2.1). + * `license-list`_ display list of available licenses. + * `help`_ display help about the plugin (goals, usage). + + +.. _comment-style-list: comment-style-list-mojo.html + +.. _license-list: license-list-mojo.html + +.. _help: help-mojo.html Property changes on: trunk/src/site/rst/get-informations.rst ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/site/rst/header.rst =================================================================== --- trunk/src/site/rst/header.rst 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/site/rst/header.rst 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,7 +1,6 @@ License Header ~~~~~~~~~~~~~~ - :Author: Tony Chemit <chemit@codelutin.com> .. contents:: @@ -11,6 +10,32 @@ :start: 1 :depth: 2 +.. #%L +.. Maven License Plugin +.. +.. $Author$ +.. $LastChangedDate$ +.. $LastChangedRevision$ +.. $Id$ +.. $HeadURL$ +.. %% +.. Copyright (C) 2008 - 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% + Abstract ======== @@ -28,13 +53,13 @@ :: - (1) #%L + (1) #\%\L (2) Project description (3) -- (4) Copyright (C) 2010 your organization (5) -- (6) License content - (7) #L% + (7) \#\L\% * (1) the start process tag used to detect begin of header (NEVER suppress it). * (2) Project description section @@ -69,45 +94,52 @@ In a file, we must box the file header in a comment. In the descriptor file you can customize it by choosing a headerType. -Available comment type -====================== +Available comment styles +======================== -Here is the available comment types. +Here is the available comment styles. Using the goal `comment-style-list`_ you can find all of them. java style ---------- -/* - * HEADER - */ +:: + /* + * HEADER + */ xml style --------- -<!-- - HEADER ---> +:: + <!-- + HEADER + --> properties style ---------------- -###### -# HEADER -###### +:: + ###### + # HEADER + ###### apt style --------- -~~~~~~ -~~ HEADER -~~~~~~ +:: + ~~~~~~ + ~~ HEADER + ~~~~~~ rst style --------- -TODO-TC20100409 Add rst implementation +:: + .. + .. HEADER + .. Ignore a header =============== Modified: trunk/src/site/rst/index.rst =================================================================== --- trunk/src/site/rst/index.rst 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/site/rst/index.rst 2010-04-10 15:37:33 UTC (rev 1733) @@ -10,12 +10,41 @@ :start: 1 :depth: 2 +.. #%L +.. Maven License Plugin +.. +.. $Author$ +.. $LastChangedDate$ +.. $LastChangedRevision$ +.. $Id$ +.. $HeadURL$ +.. %% +.. Copyright (C) 2008 - 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% + Maven license Plugin ==================== -The Maven License Plugin is used to add or update the header (with license) on -files. +The Maven License Plugin is used to deal with license stuff on a maven project. +.. NOTE:: + The process tags are separated by space otherwise plugin can NOT update header of this file! + + License header ~~~~~~~~~~~~~~ @@ -25,7 +54,7 @@ :: - #%L Content #L% + # % L Content # L % The header is composed of two parts : @@ -38,7 +67,7 @@ :: /* - * #%L + * # % L * Plugin maven de changement de license * -- * Copyright (C) 2008 - 2009 CodeLutin @@ -56,7 +85,7 @@ * 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% + * # L % */ Goals Overview @@ -64,20 +93,24 @@ The plugin has the following goals: - * `license add-license`_ add (and creates it if not found) the LICENSE.txt in the build. + * `update-project-license`_ adds or updates license project file (since 2.1). - * `license add-third-party`_ creates the THIRD-PARTY.txt in the build. + * `update-license`_ adds or updates license header on some files (since 2.1). - * `license generator-list`_ display list of available generators. + * `add-third-party`_ creates the THIRD-PARTY.txt in the build. - * `license help`_ display help about the plugin (goals, usage). + * `comment-style-list`_ display list of available comment style header (since 2.1). - * `license license-list`_ display list of available license. + * `license-list`_ display list of available licenses. - * `license update-license`_ add or update license header on some files (new versions). + * `help`_ display help about the plugin (goals, usage). - * `license update-header`_ add or update license header on some files (deprecated). + * `add-license`_ add (and creates it if not found) the LICENSE.txt in the build (deprecated since 2.1). + * `update-header`_ add or update license header on some files (deprecated since 2.1). + + * `generator-list`_ display list of available generators (deprecated since 2.1). + Usage ~~~~~ @@ -88,16 +121,22 @@ to be done. -.. _license add-license: add-license-mojo.html +.. _update-project-license: update-project-license-mojo.html -.. _license add-third-party: add-third-party-mojo.html +.. _update-license: update-license-mojo.html -.. _license update-header: update-header-mojo.html +.. _comment-style-list: comment-style-list-mojo.html -.. _license generator-list: generator-list-mojo.html +.. _add-license: add-license-mojo.html -.. _license license-list: license-list-mojo.html +.. _add-third-party: add-third-party-mojo.html -.. _license help: help-mojo.html +.. _update-header: update-header-mojo.html +.. _generator-list: generator-list-mojo.html + +.. _license-list: license-list-mojo.html + +.. _help: help-mojo.html + .. _usage: usage.html Modified: trunk/src/site/rst/usage.rst =================================================================== --- trunk/src/site/rst/usage.rst 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/site/rst/usage.rst 2010-04-10 15:37:33 UTC (rev 1733) @@ -10,42 +10,68 @@ :start: 1 :depth: 2 +.. +.. #%L +.. Maven License Plugin +.. +.. $Author$ +.. $LastChangedDate$ +.. $LastChangedRevision$ +.. $Id$ +.. $HeadURL$ +.. %% +.. Copyright (C) 2008 - 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% +.. -add-license goal -================ +Actions +======= +update-project-license goal +___________________________ + This goal creates or updates the LICENSE.txt file and add it in build. -for full detail see `add-license`_ detail page. +It can also generate a bundle License file to avoid name collision in a final +application. -add-third-party goal -==================== +for full detail see `update-project-license`_ detail page. -This goal build the THIRD-PARTY.txt file and add it in build. +update-license goal +___________________ -for full detail see `add-third-party`_ detail page. +This goal adds or updates the license header on some files using a xml +descriptor file to describe all files to include in license process for a whole +module. -generator-list goal -=================== +for full detail see `update-license`_ detail page. -This goal display of available header generators. +add-third-party goal +____________________ -Use it directly (and only) from commandline : +This goal build the THIRD-PARTY.txt file and add it in build. -:: +for full detail see `add-third-party`_ detail page. - mvn license:generator-list +Get informations +================ -To display an example of each generator, use the *detail* parameter : - -:: - - mvn license:generator-list -Ddetail - -for full detail see `generator-list`_ detail page. - license-list goal -================= +_________________ This goal display of available licenses. @@ -63,269 +89,107 @@ for full detail see `license-list`_ detail page. -update-header goal -================== +comment-style-list goal +_______________________ -**This goal is deprectaed since v 2.1** +This goal display of available comment style to box file header. -Prefer use now the **update-license** goal. +Use it directly (and only) from commandline : -This goal adds or updates the license header on some files. +:: -for full detail see `update-header`_ detail page. + mvn license:comment-style-list -update-license goal -=================== +To display the example, use the *detail* parameter : -This goal adds or updates the license header on some files using a xml -descriptor file to describe all files to include in license process for a whole -module. - -for full detail see `update-license`_ detail page. - -How does it work ? -~~~~~~~~~~~~~~~~~~ - -TODO-TC20100409 This is correct since 2.1 (redo a complete doc before 2.2) - -The plugin is looking in the included files for the text between the tags : - :: - *##% My Header ##%* + mvn license:comment-style-list -Ddetail -If the pattern is not found, it will add a license header, otherwise it will -update the content of the text between tags (here *My MyHeader*). +for full detail see `comment-style-list`_ detail page. -The plugin will seek in all projets sources roots (and test sources roots). +help goal +_________ -Note : to detect the license header we use the `nuiton-processor`_ library. -Update java files -~~~~~~~~~~~~~~~~~ +This goal display the help of the plugin (available goals). -The usual files to use such license header are java sources, that's why it is -configure to do this task and should ask you the minimum config +Use it directly (and only) from commandline : :: - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin</artifactId> - <version>XXX</version> - <configuration> - <licenseName>lgpl_v3</licenseName> - </configuration> - </plugin> + mvn license:help -will add or update for all java source files of the module (and java test files). +To display verbose help : -The command can be launch on the commandline : - :: - mvn license:update-header -Dlicense.licenseName=lgpl_v3 + mvn license:help -Ddetail -It is possible to use it with other files... (see next) +for full detail see `help`_ detail page. -Construct the license header -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Deprecated goals since 2.1 +========================== -We explain here how to build your own license header. +Some has been deprecated since we used a unified license project descriptor. -The licenseName property -************************ +add-license goal +________________ -The *licenseName* property indicates which license header to use in the -file header. +**This goal is deprectaed since v 2.1** -See the goal license:license-list. +This goal creates or updates the LICENSE.txt file and add it in build. -The generatorName property -************************** +for full detail see `add-license`_ detail page. -The *generatorName* property allows you to change the type of header to add or -update. At the moment there is two kinds of generator : +update-header goal +__________________ - * *license-java* generator, which box the license header in a java comment style - * *license-xml* generator, which box the license header in a xml comment style - * *license-properties* generator, which box the license header in a properties comment style (dashed) +**This goal is deprectaed since v 2.1** -See the goal license:generator-list. +Prefer use now the **update-license** goal. -Example of java license header : +This goal adds or updates the license header on some files. -:: +for full detail see `update-header`_ detail page. - /* - * *##% - * Plugin maven de changement de license - * Copyright (C) 2008 - 2009 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>. - * ##%* - */ +generator-list goal +___________________ -Example of xml license header : +**This goal is deprectaed since v 2.1** -:: +This goal display of available header generators. - <!-- - *##% - Plugin maven de changement de license - Copyright (C) 2008 - 2009 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>. - ##%* - --> +Use it directly (and only) from commandline : -Example of properties license header : - :: - ############################################################################### - # *##% - # Plugin maven de changement de license - # Copyright (C) 2008 - 2009 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>. - # ##%* - ############################################################################### + mvn license:generator-list -The template property -********************* +To display an example of each generator, use the *detail* parameter : -The velocity template to use to generate the full license header text. - -The template can be a class-path resource, or a file. - -By default, the is a template offers by the plugin */license/default.vm* - :: - $projectName - Copyright (C) $inceptionYear $organizationName + mvn license:generator-list -Ddetail - $licenseContent +for full detail see `generator-list`_ detail page. -If you want to write your own template, here is the list of available properties -in the velocity template : +.. _update-project-license: update-project-license-mojo.html - * *projectName* - * *inceptionYear* - * *organizationName* - * *licenseContent* +.. _update-license: update-license-mojo.html -And also, all entries of property *templateParameters*. +.. _add-third-party: add-third-party-mojo.html -After been generated, all lines of the content is prefix with generator linePrefix. +.. _license-list: license-list-mojo.html -Other properties -**************** +.. _comment-style-list: comment-style-list-mojo.html -There is some other properties used to build the header : +.. _help: help-mojo.html - * *projectName* - * *inceptionYear* - * *organizationName* - * *templateParameters* +.. _nuiton-processor : http://maven-site.nuiton.org/processor/index.html -See the goal `detail`_ page to have them all. - - -.. _detail: update-header-mojo.html - - -Files to treate -~~~~~~~~~~~~~~~ - -To change the set of files to treate, use the *includes* and *excludes* -properties. - -By default, the mojo will scan in all source roots and test source roots - -:: - - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin</artifactId> - <version>XXX</version> - <configuration> - <includes>**/*.xml,**/*.html</includes> - <excludes>**/site.xml</excludes> - </configuration> - </plugin> - - -help goal -========= - - -This goal display the help of the plugin (available goals). - -Use it directly (and only) from commandline : - -:: - - mvn license:help - -To display verbose help : - -:: - - mvn license:help -Ddetail - -for full detail see `help`_ detail page. - - .. _add-license: add-license-mojo.html -.. _add-third-party: add-third-party-mojo.html - .. _update-header: update-header-mojo.html -.. _update-license: update-license-mojo.html - .. _generator-list: generator-list-mojo.html - -.. _license-list: license-list-mojo.html - -.. _help: help-mojo.html - -.. _nuiton-processor : http://maven-site.nuiton.org/processor/index.html Modified: trunk/src/site/site_en.xml =================================================================== --- trunk/src/site/site_en.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/site/site_en.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,24 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - *##% + #%L Maven License Plugin + $Author$ + $LastChangedDate$ + $LastChangedRevision$ + $Id$ + $HeadURL$ + %% Copyright (C) 2008 - 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 + 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 + + 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 name="${project.name}"> <bannerLeft> @@ -48,14 +54,22 @@ <item name="Introduction" href="index.html"/> <item name="File header model" href="header.html"/> <item name="License project descriptor" href="descriptor.html"/> - <item name="Usage" href="usage.html"/> - <item name="Goals" href="plugin-info.html"> - <item name="add-license" href="add-license-mojo.html"/> - <item name="add-third-party" href="add-third-party-mojo.html"/> - <item name="update-header" href="update-header-mojo.html"/> - <item name="generator-list" href="generator-list-mojo.html"/> - <item name="license-list" href="license-list-mojo.html"/> - <item name="help" href="help-mojo.html"/> + <item name="Usage" href="usage.html"> + <item name="Actions" href="actions.html"> + <item name="update-project-license" href="update-project-license-mojo.html"/> + <item name="update-license" href="update-license-mojo.html"/> + <item name="add-third-party" href="add-third-party-mojo.html"/> + </item> + <item name="Get informations" href="get-informations.html"> + <item name="license-list" href="license-list-mojo.html"/> + <item name="comment-style-list" href="comment-style-list-mojo.html"/> + <item name="help" href="help-mojo.html"/> + </item> + <item name="Deprecated goals" href="deprecated-mojos.html"> + <item name="add-license" href="add-license-mojo.html"/> + <item name="update-header" href="update-header-mojo.html"/> + <item name="generator-list" href="generator-list-mojo.html"/> + </item> </item> </menu> Modified: trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.junit.Test; @@ -11,6 +10,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + * @deprecated since 2.1, will be remove soon. + */ +@Deprecated public class AddLicenseFileMojoTest extends AbstractMojoTest<AddLicenseFileMojo> { @Override Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.junit.Test; @@ -14,7 +13,7 @@ import static org.junit.Assert.assertTrue; /** - * @author tchemit <chemit àcodelutin.com> + * @author tchemit <chemit@codelutin.com> * @since 1.0 * @deprecated since 2.1, will be remove soon. */ @@ -78,7 +77,7 @@ } for (String p : mandatoryPatterns) { - checkPattern(f,content, p, true); + checkPattern(f, content, p, true); } for (String p : excludePatterns) { checkPattern(f, content, p, false); @@ -93,8 +92,8 @@ * @param required * @param f * @throws IOException - * @deprecated since 2.1, prefer use the - * {@link #checkPattern(File, String, String, boolean)} method instead. + * @deprecated since 2.1, prefer use the + * {@link #checkPattern(File, String, String, boolean)} method instead. */ @Deprecated protected void checkPattern(String content, Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin; import org.junit.Assert; @@ -15,7 +14,7 @@ * @since 2.1 */ public class UpdateLicenseMojoTest extends AbstractMojoTest<UpdateLicenseMojo> { - + @Override protected String getGoalName(String methodName) { return "update-license"; @@ -89,7 +88,7 @@ // check header checkPattern(f, content, "Copyright (C) 2000 Codelutin Do not update!", true); - checkPattern(f, content, " * %%Ignore-License", true); + checkPattern(f, content, " * %" + "%Ignore-License", true); checkPattern(f, content, "yet another license", true); checkPattern(f, content, "NEVER_FINd_ME!", false); @@ -100,11 +99,19 @@ // check header (description + copyright) does not changed checkPattern(f, content, "Copyright (C) 2000 Codelutin Do not update!", true); - checkPattern(f, content, " * %%Ignore-License", true); + checkPattern(f, content, " * %" + "%Ignore-License", true); checkPattern(f, content, "yet another license", true); checkPattern(f, content, "NEVER_FINd_ME!", false); } + @Test + public void skip() throws Exception { + + UpdateLicenseMojo mojo = getMojo(); + mojo.execute(); + Assert.assertTrue(mojo.isSkip()); + } + protected File getMyBeanFile(String testName) { File f = PluginHelper.getFile(getBasedir(), "target", Added: trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java (rev 0) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,116 @@ +package org.nuiton.license.plugin; + +import org.junit.Assert; +import org.junit.Test; +import org.nuiton.plugin.AbstractMojoTest; +import org.nuiton.plugin.PluginHelper; + +import java.io.File; +import java.io.IOException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class UpdateProjectLicenseMojoTest extends AbstractMojoTest<UpdateProjectLicenseMojo> { + + @Override + protected String getGoalName(String methodName) { + return "update-project-license"; + } + + @Override + protected void setUpMojo(UpdateProjectLicenseMojo mojo, + File pomFile) throws Exception { + super.setUpMojo(mojo, pomFile); + if (mojo.isSkip()) { + return; + } + // license is where the pom is + File outputDirectory = pomFile.getParentFile(); + mojo.setOutputDirectory(outputDirectory); + mojo.setDescriptor( + new File(outputDirectory, mojo.getDescriptor().getName())); + if (!outputDirectory.exists()) { + if (!outputDirectory.mkdirs()) { + throw new IOException( + "could not create directory : " + outputDirectory); + } + } + mojo.setLicenseFile(new File(pomFile.getParentFile(), + mojo.getLicenseFile().toString()) + ); + + log.info("pom : " + + getRelativePathFromBasedir(mojo.getProject().getFile())); + log.info("outputDirectory : " + + getRelativePathFromBasedir(mojo.getOutputDirectory())); + log.info("licenseFile : " + + getRelativePathFromBasedir(mojo.getLicenseFile())); + } + + @Test + public void testOne() throws Exception { + + UpdateProjectLicenseMojo mojo = getMojo(); + + File licenseFile = mojo.getLicenseFile(); + long t0 = licenseFile.lastModified(); + + // always assume pom is older than any file + // since we can not ensure order of copy test resources + PluginHelper.setLastModified(mojo.getProject().getFile(), 0); + + // then executing the mojo, will do NOT change the licence file + mojo.execute(); + + long t1 = licenseFile.lastModified(); + + assertEquals(t0, t1); + + // force to override the license file + mojo.setForce(true); + + mojo.execute(); + t1 = licenseFile.lastModified(); + + assertTrue(t1 > t0); + } + + @Test + public void testTwo() throws Exception { + + UpdateProjectLicenseMojo mojo = getMojo(); + + File licenseFile = mojo.getLicenseFile(); + long t0 = licenseFile.lastModified(); + + // always assume pom is older than any file + // since we can not ensure order of copy test resources + PluginHelper.setLastModified(mojo.getProject().getFile(), 0); + + // then executing the mojo, will do NOT change the licence file + mojo.execute(); + + long t1 = licenseFile.lastModified(); + + assertEquals(t0, t1); + + // force to override the license file + mojo.setForce(true); + + mojo.execute(); + t1 = licenseFile.lastModified(); + + assertTrue(t1 > t0); + } + + + @Test + public void skip() throws Exception { + + UpdateProjectLicenseMojo mojo = getMojo(); + mojo.execute(); + Assert.assertTrue(mojo.isSkip()); + + } +} \ No newline at end of file Property changes on: trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.header.transformer; import org.junit.After; Modified: trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.model; import org.junit.Assert; Modified: trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,4 +1,3 @@ - package org.nuiton.license.plugin.model; import org.junit.Assert; Modified: trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testOne.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testOne.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testOne.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,32 +1,34 @@ <?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"> +<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"> - <groupId>org.nuiton</groupId> - <artifactId>maven-helper-plugin-testOne</artifactId> - <version>0</version> - <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton</groupId> + <artifactId>maven-helper-plugin-testOne</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> - <build> + <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin</artifactId> - <configuration> - <encoding>UTF-8</encoding> - <licenseName>lgpl_v3</licenseName> - <licenseFile>licenseOne.txt</licenseFile> - <!--<outputDirectory>test</outputDirectory>--> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <goals> - <goal>add-license</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <encoding>UTF-8</encoding> + <licenseName>lgpl_v3</licenseName> + <licenseFile>licenseOne.txt</licenseFile> + <!--<outputDirectory>test</outputDirectory>--> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>add-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Modified: trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testTwo.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testTwo.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testTwo.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -1,34 +1,34 @@ <?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"> +<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> - <groupId>org.nuiton</groupId> - <artifactId>maven-helper-plugin-testOne</artifactId> - <version>0</version> - - <build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton</groupId> + <artifactId>maven-helper-plugin-testOne</artifactId> + <version>0</version> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin</artifactId> - <configuration> - <encoding>UTF-8</encoding> - <licenseName>lgpl_v3</licenseName> - <licenseFile>licenseTwo.txt</licenseFile> - <!--<outputDirectory>test</outputDirectory>--> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <goals> - <goal>add-license</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <encoding>UTF-8</encoding> + <licenseName>lgpl_v3</licenseName> + <licenseFile>licenseTwo.txt</licenseFile> + <!--<outputDirectory>test</outputDirectory>--> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>add-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/bug_28.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/bug_28.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/bug_28.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -2,43 +2,45 @@ <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"> - - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin-bug_28</artifactId> - <version>0</version> - <modelVersion>4.0.0</modelVersion> - <name>TestOne</name> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin-bug_28</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> - <build> + <name>TestOne</name> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin</artifactId> - <configuration> - <projectName>maven-license-plugin-bug_28</projectName> - <organizationName>CodeLutin</organizationName> - <inceptionYear>2009</inceptionYear> - <encoding>UTF-8</encoding> - <licenseName>lgpl_v3</licenseName> - <generatorName>license-java</generatorName> - <template>/license/defaultHeader.vm</template> - <compileSourceRoots> - <dir>target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/bug_28</dir> - </compileSourceRoots> - <testSourceRoots/> - <includes>**/*.java2</includes> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <goals> - <goal>update-header</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <projectName>maven-license-plugin-bug_28</projectName> + <organizationName>CodeLutin</organizationName> + <inceptionYear>2009</inceptionYear> + <encoding>UTF-8</encoding> + <licenseName>lgpl_v3</licenseName> + <generatorName>license-java</generatorName> + <template>/license/defaultHeader.vm</template> + <compileSourceRoots> + <dir> + target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/bug_28 + </dir> + </compileSourceRoots> + <testSourceRoots/> + <includes>**/*.java2</includes> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-header</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/java.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/java.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/java.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -2,43 +2,45 @@ <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"> - - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin-java</artifactId> - <version>0</version> - <modelVersion>4.0.0</modelVersion> - <name>TestOne</name> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin-java</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> - <build> + <name>TestOne</name> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin</artifactId> - <configuration> - <projectName>maven-license-plugin-java</projectName> - <organizationName>CodeLutin</organizationName> - <inceptionYear>2009</inceptionYear> - <encoding>UTF-8</encoding> - <licenseName>lgpl_v3</licenseName> - <generatorName>license-java</generatorName> - <template>/license/defaultHeader.vm</template> - <compileSourceRoots> - <dir>target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/java</dir> - </compileSourceRoots> - <testSourceRoots/> - <includes>**/*.java2,**/*.css</includes> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <goals> - <goal>update-header</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <projectName>maven-license-plugin-java</projectName> + <organizationName>CodeLutin</organizationName> + <inceptionYear>2009</inceptionYear> + <encoding>UTF-8</encoding> + <licenseName>lgpl_v3</licenseName> + <generatorName>license-java</generatorName> + <template>/license/defaultHeader.vm</template> + <compileSourceRoots> + <dir> + target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/java + </dir> + </compileSourceRoots> + <testSourceRoots/> + <includes>**/*.java2,**/*.css</includes> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-header</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/properties.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/properties.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/properties.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -2,41 +2,43 @@ <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"> - - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin-properties</artifactId> - <version>0</version> - <modelVersion>4.0.0</modelVersion> - <name>TestOne</name> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin-properties</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> - <build> + <name>TestOne</name> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin</artifactId> - <configuration> - <projectName>maven-license-plugin-properties</projectName> - <organizationName>CodeLutin</organizationName> - <inceptionYear>2009</inceptionYear> - <encoding>UTF-8</encoding> - <licenseName>lgpl_v3</licenseName> - <generatorName>license-properties</generatorName> - <template>/license/defaultHeader.vm</template> - <compileSourceRoots>target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/properties</compileSourceRoots> - <testSourceRoots/> - <includes>**/*.properties,**/*.sh</includes> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <goals> - <goal>update-header</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <projectName>maven-license-plugin-properties</projectName> + <organizationName>CodeLutin</organizationName> + <inceptionYear>2009</inceptionYear> + <encoding>UTF-8</encoding> + <licenseName>lgpl_v3</licenseName> + <generatorName>license-properties</generatorName> + <template>/license/defaultHeader.vm</template> + <compileSourceRoots> + target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/properties + </compileSourceRoots> + <testSourceRoots/> + <includes>**/*.properties,**/*.sh</includes> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-header</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/xml.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/xml.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/xml.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -2,43 +2,45 @@ <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"> - - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin-xml</artifactId> - <version>0</version> - <modelVersion>4.0.0</modelVersion> - <name>TestOne</name> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin-xml</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> - <build> + <name>TestOne</name> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-license-plugin</artifactId> - <configuration> - <projectName>maven-license-plugin-xml</projectName> - <organizationName>CodeLutin</organizationName> - <inceptionYear>2009</inceptionYear> - <encoding>UTF-8</encoding> - <licenseName>lgpl_v3</licenseName> - <generatorName>license-xml</generatorName> - <template>/license/defaultHeader.vm</template> - <compileSourceRoots> - <dir>target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/xml</dir> - </compileSourceRoots> - <testSourceRoots/> - <includes>**/*.xml,**/*.html</includes> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <goals> - <goal>update-header</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <projectName>maven-license-plugin-xml</projectName> + <organizationName>CodeLutin</organizationName> + <inceptionYear>2009</inceptionYear> + <encoding>UTF-8</encoding> + <licenseName>lgpl_v3</licenseName> + <generatorName>license-xml</generatorName> + <template>/license/defaultHeader.vm</template> + <compileSourceRoots> + <dir> + target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/xml + </dir> + </compileSourceRoots> + <testSourceRoots/> + <includes>**/*.xml,**/*.html</includes> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-header</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,33 @@ +<?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"> + + <groupId>org.nuiton.license.test</groupId> + <artifactId>maven-license-plugin-java</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> + + <name>Add License to MyBean</name> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <skipUpdateLicense>true</skipUpdateLicense> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1 @@ +dummy license \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1 @@ +dummy license \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,6 @@ +<?xml version='1.0' encoding='UTF-8'?> +<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd"> + <mainLicense>lgpl_v3</mainLicense> +</project> Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,6 @@ +<?xml version='1.0' encoding='UTF-8'?> +<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd"> + <mainLicense>gpl_v3</mainLicense> +</project> Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,33 @@ +<?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"> + + <groupId>org.nuiton.license.test</groupId> + <artifactId>maven-license-plugin-update-project-file</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> + + <name>Update project License file</name> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <skipUpdateProjectLicense>true</skipUpdateProjectLicense> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-project-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,35 @@ +<?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"> + + <groupId>org.nuiton</groupId> + <artifactId>maven-helper-plugin-testOne</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <encoding>UTF-8</encoding> + <descriptor>${basedir}/projectOne.xml</descriptor> + <licenseFile>licenseOne.txt</licenseFile> + <!--<outputDirectory>test</outputDirectory>--> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-project-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + + </build> +</project> \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml 2010-04-10 15:37:33 UTC (rev 1733) @@ -0,0 +1,34 @@ +<?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> + <groupId>org.nuiton</groupId> + <artifactId>maven-helper-plugin-testOne</artifactId> + <version>0</version> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <encoding>UTF-8</encoding> + <descriptor>projectTwo.xml</descriptor> + <licenseFile>licenseTwo.txt</licenseFile> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-project-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + + </build> +</project> \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL