r1735 - in trunk/src: it it/update-file-header it/update-license main/java/org/nuiton/license/plugin main/java/org/nuiton/license/plugin/header main/java/org/nuiton/license/plugin/header/generator main/java/org/nuiton/license/plugin/header/transformer main/java/org/nuiton/license/plugin/model site site/rst test/java/org/nuiton/license/plugin test/java/org/nuiton/license/plugin/header/transformer test/java/org/nuiton/license/plugin/model test/resources/org/nuiton/license/plugin
Author: tchemit Date: 2010-04-10 22:45:56 +0200 (Sat, 10 Apr 2010) New Revision: 1735 Log: - add more tests - update file header - finalize api Added: trunk/src/it/update-file-header/ trunk/src/it/update-file-header/pom.xml trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all.xml trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Add.java trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Fail.java trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Ignore.java trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Update.java trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense.xml trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/src/ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/src/MyBean.java trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/skip.xml Removed: trunk/src/it/update-file-header/pom.xml trunk/src/it/update-license/LICENSE.txt trunk/src/it/update-license/README.txt trunk/src/it/update-license/changelog.txt trunk/src/it/update-license/invoker.properties trunk/src/it/update-license/pom.xml trunk/src/it/update-license/src/ trunk/src/it/update-license/verify.groovy trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.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/UpdateProjectLicenseMojo.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/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/UpdateProjectLicenseMojoTest.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/updateFileHeaderMojoTest/addLicense.xml trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/src/MyBean.java trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense.xml trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/src/MyBean.java trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense.xml trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/src/MyBean.java Deleted: trunk/src/it/update-file-header/pom.xml =================================================================== --- trunk/src/it/update-license/pom.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/it/update-file-header/pom.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <groupId>org.nuiton.license.test</groupId> - <artifactId>test-update-header-file</artifactId> - <version>@pom.version@</version> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>License Test :: update-header-file</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> - </configuration> - <executions> - <execution> - <id>first</id> - <goals> - <goal>update-license</goal> - </goals> - <phase>process-sources</phase> - </execution> - <execution> - <!-- this execution is to test with no files --> - <id>second</id> - <goals> - <goal>update-license</goal> - </goals> - <phase>compile</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> - - Copied: trunk/src/it/update-file-header/pom.xml (from rev 1733, trunk/src/it/update-license/pom.xml) =================================================================== --- trunk/src/it/update-file-header/pom.xml (rev 0) +++ trunk/src/it/update-file-header/pom.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,70 @@ +<?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-file-header</artifactId> + <version>@pom.version@</version> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>License Test :: update-file-header</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> + </configuration> + <executions> + <execution> + <id>first</id> + <goals> + <goal>update-file-header</goal> + </goals> + <phase>process-sources</phase> + </execution> + <execution> + <!-- this execution is to test with no files --> + <id>second</id> + <goals> + <goal>update-file-header</goal> + </goals> + <phase>compile</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> + + Deleted: trunk/src/it/update-license/LICENSE.txt =================================================================== --- trunk/src/it/update-license/LICENSE.txt 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/it/update-license/LICENSE.txt 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,166 +0,0 @@ - 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. - Deleted: trunk/src/it/update-license/README.txt =================================================================== --- trunk/src/it/update-license/README.txt 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/it/update-license/README.txt 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,2 +0,0 @@ -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. Deleted: trunk/src/it/update-license/changelog.txt =================================================================== --- trunk/src/it/update-license/changelog.txt 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/it/update-license/changelog.txt 2010-04-10 20:45:56 UTC (rev 1735) @@ -1 +0,0 @@ -see the changelog of org.nuiton:i18n project. \ No newline at end of file Deleted: trunk/src/it/update-license/invoker.properties =================================================================== --- trunk/src/it/update-license/invoker.properties 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/it/update-license/invoker.properties 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,21 +0,0 @@ -# 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 compile - -# 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 Deleted: trunk/src/it/update-license/pom.xml =================================================================== --- trunk/src/it/update-license/pom.xml 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/it/update-license/pom.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <groupId>org.nuiton.license.test</groupId> - <artifactId>test-update-license</artifactId> - <version>@pom.version@</version> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>License Test :: update-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> - </configuration> - <executions> - <execution> - <id>first</id> - <goals> - <goal>update-license</goal> - </goals> - <phase>process-sources</phase> - </execution> - <execution> - <!-- this execution is to test with no files --> - <id>second</id> - <goals> - <goal>update-license</goal> - </goals> - <phase>compile</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> - - Deleted: trunk/src/it/update-license/verify.groovy =================================================================== --- trunk/src/it/update-license/verify.groovy 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/it/update-license/verify.groovy 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,24 +0,0 @@ - -file = new File(basedir, 'src/main/java/org/nuiton/license/plugin/test/MyBean.java'); -assert file.exists(); - -content = file.text; -assert content.contains( 'Copyright (C) 2012 License Test' ); - -file = new File(basedir, 'src/main/java/org/nuiton/license/plugin/test/MyBean2.java'); -assert file.exists(); - -content = file.text; -assert content.contains( 'Copyright (C) 2010 Tony' ); -assert content.contains( 'do NOT update!' ); -assert !content.contains( 'Fake to be removed!' ); - -file = new File(basedir, 'src/main/java/org/nuiton/license/plugin/test/MyBean3.java'); -assert file.exists(); - -content = file.text; -assert content.contains( ' * %%Ignore-License' ); -assert content.contains( ' * yet another license' ); -assert content.contains( ' * Copyright (C) 2000 Codelutin Do not update!' ); - -return true; Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.apache.maven.plugin.MojoExecutionException; Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.apache.commons.lang.StringUtils; Modified: trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.nuiton.license.plugin.model.License; Modified: trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.apache.maven.artifact.Artifact; Modified: trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.apache.maven.plugin.MojoExecutionException; Copied: trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java (from rev 1733, trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java) =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java (rev 0) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,701 @@ +/* + * #%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% + */ + +package org.nuiton.license.plugin; + +import org.apache.commons.lang.StringUtils; +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.project.FileSet; +import org.nuiton.license.plugin.model.project.LicenseSet; +import org.nuiton.plugin.PluginHelper; + +import java.io.File; +import java.io.IOException; +import java.util.*; + +/** + * The goal to update (or add) the licence header on some files and also update + * (or add) the project license file. + * <p/> + * This goal replace the {@code update-header} goal which can not deal with + * Copyright. + * <p/> + * This goal use a specific project file descriptor {@code project.xml} to + * describe all files to update for a whole project. + * + * @author tchemit <chemit@codelutin.com> + * @requiresProject true + * @goal update-file-header + * @since 2.1 + */ +public class UpdateFileHeaderMojo extends AbstractLicenseWithDescriptorMojo { + + /** + * Name of project (or module). + * <p/> + * Will be used as description section of new header. + * + * @parameter expression="${license.projectName}" default-value="${project.name}" + * @required + * @since 2.1 + */ + protected String projectName; + + /** + * Name of project's organization. + * <p/> + * Will be used as copyrigth's holder in new header. + * + * @parameter expression="${license.organizationName}" default-value="${project.organization.name}" + * @required + * @since 2.1 + */ + protected String organizationName; + + /** + * Inception year of the project. + * <p/> + * Will be used as first year of copyright section in new header. + * + * @parameter expression="${license.inceptionYear}" default-value="${project.inceptionYear}" + * @required + * @since 2.1 + */ + protected String inceptionYear; + + /** + * 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 + */ + protected boolean addSvnKeyWords; + + /** + * A flag to update copyright application time (change copyright last year + * if required) according to the last commit made on the processed file. + * + * @parameter expression="${license.updateCopyright}" default-value="false" + * @since 2.1 + */ + protected boolean updateCopyright; + + /** + * 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}" + * @since 2.1 + */ + protected String ignoreTag; + + /** + * A flag to skip the goal. + * + * @parameter expression="${license.skipUpdateLicense}" default-value="false" + * @since 2.1 + */ + protected boolean skipUpdateLicense; + + /** + * A flag to test plugin but modify no file. + * + * @parameter expression="${dryRun}" default-value="false" + * @since 2.1 + */ + protected boolean dryRun; + + /** + * A flag to clear everything after execution. + * <p/> + * <b>Note:</b> This property should ONLY be used for test purpose. + * + * @parameter expression="${license.clearAfterOperation}" default-value="true" + * @since 2.1 + */ + protected boolean clearAfterOperation; + + /** timestamp used for generation */ + protected long timestamp; + + /** set of processed files */ + protected Set<File> processedFiles; + + /** set of updated files */ + protected Set<File> updatedFiles; + + /** set of added header files */ + protected Set<File> addedFiles; + + /** set of ignored files */ + protected Set<File> ignoreFiles; + + /** set of failed files */ + protected Set<File> failedFiles; + + @Override + public void init() throws Exception { + + if (isSkip()) { + 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 (String transformerName : getTransformers().keySet()) { + FileHeaderTransformer transformer = + getTransformer(transformerName); + String str = String.format(commentFormat, + transformer.getName(), + transformer.getDescription() + ); + buffer.append(str); + } + getLog().info(buffer.toString()); + } + + if (updateCopyright) { + + getLog().warn("updateCopyright is not still available..."); + //TODO-TC20100409 checks scm + // checks scm is ok + // for the moment, will only deal with svn except if scm + // offers a nice api to obtain last commit date on a file + + } + + // set timestamp used for temporary files + setTimestamp(System.nanoTime()); + + super.init(); + } + + @Override + public void doAction() throws Exception { + + // create a file header processor which updates license content only + FileHeaderProcessor processor = new FileHeaderProcessor() { + + @Override + public FileHeaderFilter newFilter( + FileHeader header, FileHeaderTransformer transformer) { + + return new UpdateLicenseHeaderFilter(header, + transformer, + isUpdateCopyright() + ); + } + }; + + clear(); + + processedFiles = new HashSet<File>(); + ignoreFiles = new HashSet<File>(); + addedFiles = new HashSet<File>(); + updatedFiles = new HashSet<File>(); + failedFiles = new HashSet<File>(); + + try { + + processFiles(processor); + } finally { + + StringBuilder buffer = new StringBuilder(); + + buffer.append("Operation result on "); + buffer.append(getProcessedFiles().size()); + buffer.append(" file(s) :"); + + reportType(getFailedFiles(), "fail", buffer); + reportType(getAddedFiles(), "add", buffer); + reportType(getUpdatedFiles(), "update", buffer); + reportType(getIgnoreFiles(), "ignore", buffer); + + getLog().info(buffer.toString()); + + if (isClearAfterOperation()) { + clear(); + } + } + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + clear(); + } + + protected void clear() { + if (processedFiles != null) { + processedFiles.clear(); + } + if (ignoreFiles != null) { + ignoreFiles.clear(); + } + if (failedFiles != null) { + failedFiles.clear(); + } + if (updatedFiles != null) { + updatedFiles.clear(); + } + if (addedFiles != null) { + addedFiles.clear(); + } + } + + protected void processFiles(FileHeaderProcessor processor) throws IOException { + for (LicenseSet licenseSet : getLicenseProject().getLicenseSets()) { + + // obtain license from definition + String licenseName = licenseSet.getLicenseName(); + License license = getLicense(licenseName); + + if (isVerbose()) { + getLog().info("process " + license.getDescription()); + } + + // file header to use if no header is found on a file + FileHeader defaultFileHeader = buildDefaultFileHeader( + license, + getProjectName(), + getInceptionYear(), + getOrganizationName(), + isAddSvnKeyWords(), + getEncoding() + ); + + // change default license header in processor + processor.setHeader(defaultFileHeader); + + for (FileSet fileSet : licenseSet.getFileSets()) { + File basedir = new File(getProject().getBasedir(), + fileSet.getBasedir()); + if (isVerbose()) { + getLog().info("process file set with basedir : " + basedir); + } + + List<String> includes = fileSet.getIncludes(); + if (includes.isEmpty()) { + + // it means include all + includes.add("**/*"); + } + List<String> excludes = fileSet.getExcludes(); + + Map<File, String[]> filestoTreate = new TreeMap<File, String[]>(); + + // obtain files to treate + getFilesToTreateForRoots( + includes.toArray(new String[includes.size()]), + excludes.isEmpty() ? null : + excludes.toArray(new String[excludes.size()]), + Arrays.asList(basedir.getAbsolutePath()), + filestoTreate, + null + ); + + // get header transformer according to file set + FileHeaderTransformer transformer = getTransformer(fileSet.getHeaderType()); + + // change transformer in processor + processor.setTransformer(transformer); + + // treate all files of entry + for (Map.Entry<File, String[]> entry : + filestoTreate.entrySet()) { + File entryBasedir = entry.getKey(); + getLog().info("process entry " + entryBasedir); + String[] paths = entry.getValue(); + getLog().info(paths.length + " file(s) to treate."); + for (String path : paths) { + File file = new File(entryBasedir, path); + if (getProcessedFiles().contains(file)) { + getLog().info("skip already processed file " + file); + continue; + } + getProcessedFiles().add(file); + updateFile(processor, file); + } + } + + filestoTreate.clear(); + } + } + } + + protected void updateFile(FileHeaderProcessor processor, + File file) throws IOException { + + getLog().debug("start for file " + file); + + // file where to write result + File processFile = new File(file.getAbsolutePath() + "_" + getTimestamp()); + getLog().debug("will process into file " + processFile); + + if (isVerbose()) { + getLog().info("process file " + file); + } + + try { + + try { + processor.process(file, processFile); + } catch (IllegalStateException e) { + + // could not obtain existing header + getLog().warn( + "skip file " + file + + " Could not extract existing header!)"); + failedFiles.add(file); + deleteFile(processFile); + return; + } + + if (processor.isTouched()) { + + if (isVerbose()) { + getLog().info("header was updated for " + file); + } + updatedFiles.add(file); + finalizeFile(file, processFile); + return; + } + + if (processor.isDetectHeader()) { + + // file has not a valid header (found a start process atg, but + // not an ending one), can not do anything + getLog().warn( + "skip file " + file + + " (no license footer tag found : '##%*' !)"); + failedFiles.add(file); + deleteFile(processFile); + return; + } + + // file has no header dealed by the plugin + + String content = PluginHelper.readAsString(file, getEncoding()); + + //check that file is not marked to be ignored + if (content.contains(getIgnoreTag())) { + getLog().info("ignore file (detected " + getIgnoreTag() + ") " + file); + + ignoreFiles.add(file); + deleteFile(processFile); + return; + } + + // no header and not marked to be ignored : add a new header + getLog().info("adding license header on file " + file); + + //FIXME-TC-20100409 form xml files must add header after a xml prolog line + content = processor.getFullHeaderContent() + "\n" + content; + if (!isDryRun()) { + writeFile(processFile, content, getEncoding()); + } + + addedFiles.add(file); + finalizeFile(file, processFile); + + } catch (Exception e) { + getLog().warn( + "skip file " + file + " (could not process " + + "for reason : " + e.getMessage() + ")", e); + deleteFile(processFile); + } finally { + + // always clean processor internal states + processor.reset(); + } + } + + protected void reportType(Set<File> set, String operation, StringBuilder buffer) { + if (set.isEmpty()) { + if (isVerbose()) { + buffer.append("\n * no header to ").append(operation).append("."); + } + } else { + buffer.append("\n * ").append(operation).append(" header on "); + buffer.append(set.size()); + if (set.size() == 1) { + buffer.append(" file."); + } else { + buffer.append(" files."); + } + if (isVerbose()) { + for (File file : set) { + buffer.append("\n - ").append(file); + } + } + } + } + + protected void finalizeFile(File file, File processFile) throws IOException { + + if (isKeepBackup() && !isDryRun()) { + File backupFile = getBackupFile(file); + + if (backupFile.exists()) { + + // always delete backup file, before the renaming + deleteFile(backupFile); + } + + if (isVerbose()) { + getLog().debug("backup original file " + file); + } + + renameFile(file, backupFile); + } + + if (isDryRun()) { + + // dry run, delete temporary file + deleteFile(processFile); + } else { + + // replace file with + renameFile(processFile, file); + } + } + + public boolean isClearAfterOperation() { + return clearAfterOperation; + } + + public long getTimestamp() { + return timestamp; + } + + public String getProjectName() { + return projectName; + } + + public String getInceptionYear() { + return inceptionYear; + } + + public String getOrganizationName() { + return organizationName; + } + + public boolean isUpdateCopyright() { + return updateCopyright; + } + + public String getIgnoreTag() { + return ignoreTag; + } + + public boolean isDryRun() { + return dryRun; + } + + @Override + public boolean isSkip() { + return skipUpdateLicense; + } + + @Override + public void setSkip(boolean skipUpdateLicense) { + this.skipUpdateLicense = skipUpdateLicense; + } + + public Set<File> getProcessedFiles() { + return processedFiles; + } + + public Set<File> getUpdatedFiles() { + return updatedFiles; + } + + public Set<File> getAddedFiles() { + return addedFiles; + } + + public Set<File> getIgnoreFiles() { + return ignoreFiles; + } + + public Set<File> getFailedFiles() { + return failedFiles; + } + + public boolean isAddSvnKeyWords() { + return addSvnKeyWords; + } + + public void setDryRun(boolean dryRun) { + this.dryRun = dryRun; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public void setSkipUpdateLicense(boolean skipUpdateLicense) { + this.skipUpdateLicense = skipUpdateLicense; + } + + public void setInceptionYear(String inceptionYear) { + this.inceptionYear = inceptionYear; + } + + public void setOrganizationName(String organizationName) { + this.organizationName = organizationName; + } + + public void setUpdateCopyright(boolean updateCopyright) { + this.updateCopyright = updateCopyright; + } + + public void setIgnoreTag(String ignoreTag) { + this.ignoreTag = ignoreTag; + } + + public void setAddSvnKeyWords(boolean addSvnKeyWords) { + this.addSvnKeyWords = addSvnKeyWords; + } + + public void setClearAfterOperation(boolean clearAfterOperation) { + this.clearAfterOperation = clearAfterOperation; + } + + public void setProcessedFiles(Set<File> processedFiles) { + this.processedFiles = processedFiles; + } + + public void setUpdatedFiles(Set<File> updatedFiles) { + this.updatedFiles = updatedFiles; + } + + public void setAddedFiles(Set<File> addedFiles) { + this.addedFiles = addedFiles; + } + + public void setIgnoreFiles(Set<File> ignoreFiles) { + this.ignoreFiles = ignoreFiles; + } + + public void setFailedFiles(Set<File> failedFiles) { + this.failedFiles = failedFiles; + } + + public class UpdateLicenseHeaderFilter extends FileHeaderFilter { + + protected final boolean updateCopyright; + + public UpdateLicenseHeaderFilter(FileHeader header, + FileHeaderTransformer transformer, + boolean updateCopyright) { + super(header, transformer); + this.updateCopyright = updateCopyright; + } + + @Override + protected String treateHeader(FileHeader header, + FileHeaderTransformer transformer, + String ch) { + + if (getLog().isDebugEnabled()) { + getLog().debug("header\n" + ch); + } + + // unbox comment + String unbox = transformer.unboxComent(ch); + + if (getLog().isDebugEnabled()) { + getLog().info("unboxed comment header\n" + unbox); + } + + // obtain current license of file + FileHeader fileHeader = transformer.toFileHeader(unbox); + + // updates license + fileHeader.setLicense(header.getLicense()); + + if (updateCopyright) { + // 1) obtain the svn last comit on this file + + // 2) compute the last year of copyright + + // 3) if necessary update last year + //fileHeader.setCopyrightLastYear(lastYear); + } + // build new brut header (with no boxing) + String newHeader = transformer.toString(fileHeader); + + // box with process tag + newHeader = transformer.boxProcessTag(newHeader); + + // box header with comment prefix + newHeader = transformer.boxComment(newHeader, false); + + // remove all before process start tag + // remove all after process end tag + // this is a requirement for processor to respect involution. + int index = newHeader.indexOf(transformer.getProcessStartTag()); + int lastIndex = + newHeader.lastIndexOf(transformer.getProcessEndTag()) + + transformer.getProcessEndTag().length(); + + String result = newHeader.substring(index, lastIndex); + + if (getLog().isDebugEnabled()) { + getLog().debug("updated Header =\n" + result); + } + + return result; + } + } +} Property changes on: trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java ___________________________________________________________________ Added: svn:keywords + HeadURL Id Date Revision Author Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.apache.maven.plugin.MojoExecutionException; Deleted: trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,511 +0,0 @@ -package org.nuiton.license.plugin; - -import org.apache.commons.lang.StringUtils; -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.project.FileSet; -import org.nuiton.license.plugin.model.project.LicenseSet; -import org.nuiton.plugin.PluginHelper; - -import java.io.File; -import java.io.IOException; -import java.util.*; - -/** - * The goal to update (or add) the licence header on some files and also update - * (or add) the project license file. - * <p/> - * This goal replace the {@code update-header} goal which can not deal with - * Copyright. - * <p/> - * This goal use a specific project file descriptor {@code project.xml} to - * describe all files to update for a whole project. - * - * @author tchemit <chemit@codelutin.com> - * @requiresProject true - * @goal update-license - * @since 2.1 - */ -public class UpdateLicenseMojo extends AbstractLicenseWithDescriptorMojo { - - /** - * Name of project (or module). - * <p/> - * Will be used as description section of new header. - * - * @parameter expression="${license.projectName}" default-value="${project.name}" - * @required - * @since 2.1 - */ - protected String projectName; - - /** - * Name of project's organization. - * <p/> - * Will be used as copyrigth's holder in new header. - * - * @parameter expression="${license.organizationName}" default-value="${project.organization.name}" - * @required - * @since 2.1 - */ - protected String organizationName; - - /** - * Inception year of the project. - * <p/> - * Will be used as first year of copyright section in new header. - * - * @parameter expression="${license.inceptionYear}" default-value="${project.inceptionYear}" - * @required - * @since 2.1 - */ - protected String inceptionYear; - - /** - * 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 - */ - protected boolean addSvnKeyWords; - - /** - * A flag to update copyright application time (change copyright last year - * if required) according to the last commit made on the processed file. - * - * @parameter expression="${license.updateCopyright}" default-value="false" - * @since 2.1 - */ - protected boolean updateCopyright; - - /** - * 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}" - * @since 2.1 - */ - protected String ignoreTag; - - /** - * A flag to skip the goal. - * - * @parameter expression="${license.skipUpdateLicense}" default-value="false" - * @since 2.1 - */ - protected boolean skipUpdateLicense; - - /** - * A flag to test plugin but modify no file. - * - * @parameter expression="${dryRun}" default-value="false" - * @since 2.1 - */ - protected boolean dryRun; - - /** timestamp used for generation */ - protected long timestamp; - - /** set of processed files */ - protected Set<File> processedFiles; - - @Override - public void init() throws Exception { - - if (isSkip()) { - 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 (String transformerName : getTransformers().keySet()) { - FileHeaderTransformer transformer = - getTransformer(transformerName); - String str = String.format(commentFormat, - transformer.getName(), - transformer.getDescription() - ); - buffer.append(str); - } - getLog().info(buffer.toString()); - } - - if (updateCopyright) { - - getLog().warn("updateCopyright is not still available..."); - //TODO-TC20100409 checks scm - // checks scm is ok - // for the moment, will only deal with svn except if scm - // offers a nice api to obtain last commit date on a file - - } - - // set timestamp used for temporary files - setTimestamp(System.nanoTime()); - - super.init(); - } - - @Override - public void doAction() throws Exception { - - // create a file header processor which updates license content only - FileHeaderProcessor processor = new FileHeaderProcessor() { - - @Override - public FileHeaderFilter newFilter( - FileHeader header, FileHeaderTransformer transformer) { - - return new UpdateLicenseHeaderFilter(header, - transformer, - isUpdateCopyright() - ); - } - }; - - processedFiles = new HashSet<File>(); - - for (LicenseSet licenseSet : getLicenseProject().getLicenseSets()) { - - // obtain license from definition - String licenseName = licenseSet.getLicenseName(); - License license = getLicense(licenseName); - - if (isVerbose()) { - getLog().info("process " + license.getDescription()); - } - - // file header to use if no header is found on a file - FileHeader defaultFileHeader = buildDefaultFileHeader( - license, - getProjectName(), - getInceptionYear(), - getOrganizationName(), - isAddSvnKeyWords(), - getEncoding() - ); - - // change default license header in processor - processor.setHeader(defaultFileHeader); - - for (FileSet fileSet : licenseSet.getFileSets()) { - File basedir = new File(getProject().getBasedir(), - fileSet.getBasedir()); - if (isVerbose()) { - getLog().info("process file set with basedir : " + basedir); - } - - List<String> includes = fileSet.getIncludes(); - if (includes.isEmpty()) { - - // it means include all - includes.add("**/*"); - } - List<String> excludes = fileSet.getExcludes(); - - Map<File, String[]> filestoTreate = new TreeMap<File, String[]>(); - - // obtain files to treate - getFilesToTreateForRoots( - includes.toArray(new String[includes.size()]), - excludes.isEmpty() ? null : - excludes.toArray(new String[excludes.size()]), - Arrays.asList(basedir.getAbsolutePath()), - filestoTreate, - null - ); - - // get header transformer according to file set - FileHeaderTransformer transformer = getTransformer(fileSet.getHeaderType()); - - // change transformer in processor - processor.setTransformer(transformer); - - // treate all files of entry - for (Map.Entry<File, String[]> entry : filestoTreate.entrySet()) { - File entryBasedir = entry.getKey(); - getLog().info("process entry " + entryBasedir); - String[] paths = entry.getValue(); - getLog().info(paths.length + " file(s) to treate."); - for (String path : paths) { - File file = new File(entryBasedir, path); - if (getProcessedFiles().contains(file)) { - getLog().info("skip already processed file " + file); - continue; - } - getProcessedFiles().add(file); - updateFile(processor, file); - } - } - } - } - if (getProcessedFiles() != null) { - getLog().info(getProcessedFiles().size() + " file(s) were treated."); - } - } - - public void updateFile(FileHeaderProcessor processor, - File file) throws IOException { - - getLog().debug("start for file " + file); - - // file where to write result - File processFile = new File(file.getAbsolutePath() + "_" + getTimestamp()); - getLog().debug("will process into file " + processFile); - - if (isVerbose()) { - getLog().info("process file " + file); - } - - try { - - processor.process(file, processFile); - - if (processor.isTouched()) { - - if (isVerbose()) { - getLog().info("header was updated for " + file); - } - - finalizeFile(file, processFile); - return; - } - - if (processor.isDetectHeader()) { - - // file has not a valid header (found a start process atg, but - // not an ending one), can not do anything - getLog().warn( - "skip file " + file + - " (no license footer tag found : '##%*' !)"); - - deleteFile(processFile); - return; - } - - // file has no header dealed by the plugin - - String content = PluginHelper.readAsString(file, getEncoding()); - - //check that file is not marked to be ignored - if (content.contains(getIgnoreTag())) { - getLog().info("ignore file (detected " + getIgnoreTag() + ") " + file); - - deleteFile(processFile); - return; - } - - // no header and not marked to be ignored : add a new header - getLog().info("adding license header on file " + file); - - //FIXME-TC-20100409 form xml files must add header after a xml prolog line - content = processor.getFullHeaderContent() + content; - if (!isDryRun()) { - writeFile(processFile, content, getEncoding()); - } - - finalizeFile(file, processFile); - - } catch (Exception e) { - getLog().warn( - "skip file " + file + " (could not process " + - "for reason : " + e.getMessage() + ")", e); - deleteFile(processFile); - } finally { - - // always clean processor internal states - processor.reset(); - } - } - - protected void finalizeFile(File file, File processFile) throws IOException { - - if (isKeepBackup() && !isDryRun()) { - File backupFile = getBackupFile(file); - - if (backupFile.exists()) { - - // always delete backup file, before the renaming - deleteFile(backupFile); - } - - if (isVerbose()) { - getLog().debug("backup original file " + file); - } - - renameFile(file, backupFile); - } - - if (isDryRun()) { - - // dry run, delete temporary file - deleteFile(processFile); - } else { - - // replace file with - renameFile(processFile, file); - } - } - - public long getTimestamp() { - return timestamp; - } - - public String getProjectName() { - return projectName; - } - - public String getInceptionYear() { - return inceptionYear; - } - - public String getOrganizationName() { - return organizationName; - } - - public boolean isUpdateCopyright() { - return updateCopyright; - } - - public String getIgnoreTag() { - return ignoreTag; - } - - public boolean isDryRun() { - return dryRun; - } - - @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 setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - public void setSkipUpdateLicense(boolean skipUpdateLicense) { - this.skipUpdateLicense = skipUpdateLicense; - } - - public void setInceptionYear(String inceptionYear) { - this.inceptionYear = inceptionYear; - } - - public void setOrganizationName(String organizationName) { - this.organizationName = organizationName; - } - - public void setUpdateCopyright(boolean updateCopyright) { - this.updateCopyright = updateCopyright; - } - - public void setIgnoreTag(String ignoreTag) { - this.ignoreTag = ignoreTag; - } - - public void setAddSvnKeyWords(boolean addSvnKeyWords) { - this.addSvnKeyWords = addSvnKeyWords; - } - - - public class UpdateLicenseHeaderFilter extends FileHeaderFilter { - - protected final boolean updateCopyright; - - public UpdateLicenseHeaderFilter(FileHeader header, - FileHeaderTransformer transformer, boolean updateCopyright) { - super(header, transformer); - this.updateCopyright = updateCopyright; - } - - @Override - protected String treateHeader(FileHeader header, - FileHeaderTransformer transformer, - String ch) { - - // unbox comment - String unbox = transformer.unboxComent(ch); - - // obtain current license of file - FileHeader fileHeader = transformer.toFileHeader(unbox); - - // updates license - fileHeader.setLicense(header.getLicense()); - - if (updateCopyright) { - // 1) obtain the svn last comit on this file - - // 2) compute the last year of copyright - - // 3) if necessary update last year - //fileHeader.setCopyrightLastYear(lastYear); - } - // build new brut header (with no boxing) - String newHeader = transformer.toString(fileHeader); - - // box with process tag - newHeader = transformer.boxProcessTag(newHeader); - - // box header with comment prefix - newHeader = transformer.boxComment(newHeader, false); - - // remove all before start process tag since we MUST begin by - // the start tag in processor logic. - int index = newHeader.indexOf(transformer.getProcessStartTag()); - - String result = newHeader.substring(index); - - // remove all extra spaces characters at the end of header (since - // we UST finish with process end tag in processor logic. - while (Character.isSpaceChar(result.charAt(result.length() - 1))) { - result = result.substring(0, result.length() - 1); - } - if (isVerbose()) { - getLog().debug("updated Header =\n" + result); - } - - return result; - } - } -} Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.nuiton.license.plugin.model.License; 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header; import org.apache.commons.logging.Log; 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header; import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer; @@ -55,7 +83,7 @@ return filter != null && filter.isDetectHeader(); } - public void process(File filein, File fileout) throws IOException { + public void process(File filein, File fileout) throws IOException, IllegalStateException { if (header == null) { throw new IllegalStateException("no file header sets."); } 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header.transformer; import org.nuiton.license.plugin.header.FileHeader; @@ -61,6 +89,17 @@ String commentLinePrefix) { this.name = name; this.description = description; + + // checks comment start tag is different from comment prefix + if (commentStartTag.equals(commentLinePrefix)) { + throw new IllegalStateException("commentStartTag can not be equals to commentPrefixLine, but was [" + commentStartTag + "]"); + } + + // checks comment end tag is different from comment prefix + if (commentEndTag.equals(commentLinePrefix)) { + throw new IllegalStateException("commentEndTag can not be equals to commentPrefixLine, but was [" + commentStartTag + "]"); + } + this.commentStartTag = commentStartTag; this.commentEndTag = commentEndTag; this.commentLinePrefix = commentLinePrefix; 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header.transformer; /** @@ -13,11 +41,11 @@ public static final String DESCRIPTION = "header transformer with apt 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_START_TAG = "~~~"; - public static final String COMMENT_END_TAG = ""; + public static final String COMMENT_END_TAG = "~~~"; public AptFileHeaderTransformer() { super(NAME, @@ -27,4 +55,26 @@ COMMENT_LINE_PREFIX ); } + +// @Override +// public String unboxComent(String header) { +// +// StringBuilder buffer = new StringBuilder(); +// int prefixLength = getCommentLinePrefix().length(); +// for (String line : header.split(LINE_SEPARATOR + "")) { +// if (line.isEmpty()) { +// +// // not be unboxed, but just skipped +// continue; +// } +// int index = line.indexOf(getCommentLinePrefix()); +// if (index > -1) { +// +// // remove comment prefix +// line = line.substring(index + prefixLength); +// } +// buffer.append(line).append(LINE_SEPARATOR); +// } +// return buffer.toString(); +// } } 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header.transformer; import org.nuiton.license.plugin.header.FileHeader; 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header.transformer; /** 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header.transformer; /** @@ -15,9 +43,9 @@ public static final String COMMENT_LINE_PREFIX = "# "; - public static final String COMMENT_START_TAG = "###############################################################################"; + public static final String COMMENT_START_TAG = "###"; - public static final String COMMENT_END_TAG = "###############################################################################"; + public static final String COMMENT_END_TAG = "###"; public PropertiesFileHeaderTransformer() { super(NAME, 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header.transformer; /** @@ -13,11 +41,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_START_TAG = ".. -"; - public static final String COMMENT_END_TAG = ".. "; + public static final String COMMENT_END_TAG = ".. -"; public RstFileHeaderTransformer() { super(NAME, 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header.transformer; /** 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/model/License.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.model; import org.apache.commons.logging.Log; Modified: trunk/src/site/rst/descriptor.rst =================================================================== --- trunk/src/site/rst/descriptor.rst 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/site/rst/descriptor.rst 2010-04-10 20:45:56 UTC (rev 1735) @@ -10,31 +10,33 @@ :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% +.. - +.. * #%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 ======== @@ -44,7 +46,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`_ and `update-project-license`_. +This new format is used in goal `update-file-header`_ and `update-project-license`_. TODO-TC-20100409 Do this documentation @@ -80,10 +82,10 @@ </licenseSets> </project> -.. _update-license: update-license-mojo.html +.. _update-file-header: update-file-header-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 +.. _xsd file: licenseProject-1.0.0.xsd Modified: trunk/src/site/rst/header.rst =================================================================== --- trunk/src/site/rst/header.rst 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/site/rst/header.rst 2010-04-10 20:45:56 UTC (rev 1735) @@ -10,38 +10,40 @@ :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% +.. - +.. * #%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 ======== This document describes the file header model introduced in version 2.1. -You will learn how to customize it and use it with the goal `update-license`_. +You will learn how to customize it and use it with the goal `update-file-header`_. Header model ============ @@ -144,7 +146,7 @@ Ignore a header =============== -If you don't want `update-license` goal to treate a specific file, you can +If you don't want `update-file-header` goal to treate a specific file, you can use a specific tag in your class : :: @@ -153,6 +155,6 @@ You can change it with **ignoreTag** property. -.. _update-license: update-license-mojo.html +.. _update-file-header: update-file-header-mojo.html .. _comment-style-list: comment-style-list-mojo.html Modified: trunk/src/site/rst/index.rst =================================================================== --- trunk/src/site/rst/index.rst 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/site/rst/index.rst 2010-04-10 20:45:56 UTC (rev 1735) @@ -10,31 +10,33 @@ :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% +.. - +.. * #%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 ==================== @@ -95,7 +97,7 @@ * `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). + * `update-file-header`_ adds or updates license header on some files (since 2.1). * `add-third-party`_ creates the THIRD-PARTY.txt in the build. @@ -123,7 +125,7 @@ .. _update-project-license: update-project-license-mojo.html -.. _update-license: update-license-mojo.html +.. _update-file-header: update-file-header-mojo.html .. _comment-style-list: comment-style-list-mojo.html Modified: trunk/src/site/rst/usage.rst =================================================================== --- trunk/src/site/rst/usage.rst 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/site/rst/usage.rst 2010-04-10 20:45:56 UTC (rev 1735) @@ -9,35 +9,34 @@ .. sectnum:: :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% +.. - -.. -.. #%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% -.. - Actions ======= @@ -51,14 +50,14 @@ for full detail see `update-project-license`_ detail page. -update-license goal -___________________ +update-file-header goal +_______________________ 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. +for full detail see `update-file-header`_ detail page. add-third-party goal ____________________ @@ -147,7 +146,7 @@ **This goal is deprectaed since v 2.1** -Prefer use now the **update-license** goal. +Prefer use now the **update-file-header** goal. This goal adds or updates the license header on some files. @@ -176,7 +175,7 @@ .. _update-project-license: update-project-license-mojo.html -.. _update-license: update-license-mojo.html +.. _update-file-header: update-file-header-mojo.html .. _add-third-party: add-third-party-mojo.html Modified: trunk/src/site/site_en.xml =================================================================== --- trunk/src/site/site_en.xml 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/site/site_en.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -57,7 +57,7 @@ <item name="Usage" href="usage.html"> <item name="Actions" href="usage.html#actions"> <item name="update-project-license" href="update-project-license-mojo.html"/> - <item name="update-license" href="update-license-mojo.html"/> + <item name="update-file-header" href="update-file-header-mojo.html"/> <item name="add-third-party" href="add-third-party-mojo.html"/> </item> <item name="Get informations" href="usage.html#get-informations"> Modified: trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.junit.Test; Copied: trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java (from rev 1733, trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java) =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java (rev 0) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,294 @@ +/* + * #%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% + */ + +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; + +/** + * Tests the {@link UpdateFileHeaderMojo}. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class UpdateFileHeaderMojoTest extends AbstractMojoTest<UpdateFileHeaderMojo> { + + @Override + protected String getGoalName(String methodName) { + return "update-file-header"; + } + + @Override + protected void clearMojo(UpdateFileHeaderMojo mojo) { + mojo.clear(); + } + + @Test + public void addLicense() throws Exception { + + File f = getMyBeanFile(getMethodName()); + + UpdateFileHeaderMojo mojo = getMojo(); + String content; + +// content = PluginHelper.readAsString(f, mojo.getEncoding()); +// +// // check no header +// checkPattern(f, content, "Copyright (C) 2010", false); +// checkPattern(f, content, "Project name : maven-license-plugin-java", false); +// checkPattern(f, content, "Organization is CodeLutin", false); + + mojo.setVerbose(true); + mojo.execute(); + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header + checkPattern(f, content, "Copyright (C) 2010", true); + checkPattern(f, content, "Project name : maven-license-plugin-java", true); + checkPattern(f, content, "Organization is CodeLutin", true); + + mojo.setVerbose(false); + mojo.execute(); + + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + Assert.assertEquals(1, mojo.getUpdatedFiles().size()); + + int oldLength = content.length(); + content = PluginHelper.readAsString(f, mojo.getEncoding()); + int newLength = content.length(); + + Assert.assertEquals(oldLength, newLength); + } + + @Test + public void all() throws Exception { + + UpdateFileHeaderMojo mojo = getMojo(); + + mojo.setClearAfterOperation(false); + mojo.setVerbose(true); + mojo.execute(); + Assert.assertEquals(4, mojo.getProcessedFiles().size()); + if (mojo.getUpdatedFiles().size() == 2) { + Assert.assertEquals(2, mojo.getUpdatedFiles().size()); + Assert.assertEquals(0, mojo.getAddedFiles().size()); + } else { + Assert.assertEquals(1, mojo.getUpdatedFiles().size()); + Assert.assertEquals(1, mojo.getAddedFiles().size()); + } + Assert.assertEquals(1, mojo.getFailedFiles().size()); + Assert.assertEquals(1, mojo.getIgnoreFiles().size()); + + mojo.setVerbose(false); + mojo.execute(); + + Assert.assertEquals(4, mojo.getProcessedFiles().size()); + Assert.assertEquals(2, mojo.getUpdatedFiles().size()); + Assert.assertEquals(0, mojo.getAddedFiles().size()); + Assert.assertEquals(1, mojo.getFailedFiles().size()); + Assert.assertEquals(1, mojo.getIgnoreFiles().size()); + + mojo.setClearAfterOperation(true); + mojo.execute(); + Assert.assertEquals(0, mojo.getProcessedFiles().size()); + Assert.assertEquals(0, mojo.getUpdatedFiles().size()); + Assert.assertEquals(0, mojo.getAddedFiles().size()); + Assert.assertEquals(0, mojo.getFailedFiles().size()); + Assert.assertEquals(0, mojo.getIgnoreFiles().size()); + + } + + @Test + public void updateLicense() throws Exception { + + File f = getMyBeanFile(getMethodName()); + + UpdateFileHeaderMojo mojo = getMojo(); + + String content; + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header + checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); + checkPattern(f, content, "License Test :: do NOT update!", true); +// checkPattern(f, content, "Fake to be removed!", true); + + mojo.setVerbose(true); + mojo.execute(); + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + Assert.assertEquals(1, mojo.getUpdatedFiles().size()); + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header (description + copyright) does not changed + checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); + checkPattern(f, content, "License Test :: do NOT update!", true); + + // check license changed + checkPattern(f, content, "Fake to be removed!", false); + + mojo.setVerbose(false); + mojo.execute(); + + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + Assert.assertEquals(1, mojo.getUpdatedFiles().size()); + + int oldLength = content.length(); + content = PluginHelper.readAsString(f, mojo.getEncoding()); + int newLength = content.length(); + + Assert.assertEquals(oldLength, newLength); + } + + + @Test + public void failLicense() throws Exception { + + File f = getMyBeanFile(getMethodName()); + + UpdateFileHeaderMojo mojo = getMojo(); + + String content; + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header + checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); + checkPattern(f, content, "License Test :: do NOT update!", true); + checkPattern(f, content, "License content do NOT update!", true); +// checkPattern(f, content, "Fake to be removed!", true); + + mojo.setVerbose(true); + mojo.execute(); + + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + Assert.assertEquals(1, mojo.getFailedFiles().size()); + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header does not changed + checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); + checkPattern(f, content, "License Test :: do NOT update!", true); + checkPattern(f, content, "License content do NOT update!", true); + + mojo.setVerbose(false); + mojo.execute(); + + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + Assert.assertEquals(1, mojo.getFailedFiles().size()); + + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header does not changed + checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); + checkPattern(f, content, "License Test :: do NOT update!", true); + checkPattern(f, content, "License content do NOT update!", true); + } + + @Test + public void ignoreLicense() throws Exception { + + File f = getMyBeanFile(getMethodName()); + + UpdateFileHeaderMojo mojo = getMojo(); + + String content; + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header + checkPattern(f, content, "Copyright (C) 2000 Codelutin Do not update!", true); + checkPattern(f, content, " * %" + "%Ignore-License", true); + checkPattern(f, content, "yet another license", true); + checkPattern(f, content, "NEVER_FINd_ME!", false); + + mojo.setVerbose(true); + mojo.execute(); + + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + Assert.assertEquals(1, mojo.getIgnoreFiles().size()); + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // 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, "yet another license", true); + checkPattern(f, content, "NEVER_FINd_ME!", false); + + mojo.setVerbose(false); + mojo.execute(); + + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + Assert.assertEquals(1, mojo.getIgnoreFiles().size()); + + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // 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, "yet another license", true); + checkPattern(f, content, "NEVER_FINd_ME!", false); + } + + @Test + public void skip() throws Exception { + + UpdateFileHeaderMojo mojo = getMojo(); + mojo.execute(); + Assert.assertTrue(mojo.isSkip()); + } + + protected File getMyBeanFile(String testName) { + File f = PluginHelper.getFile(getBasedir(), + "target", + "test-classes", + "org", + "nuiton", + "license", + "plugin", + "updateFileHeaderMojoTest", + testName, + "src", + "MyBean.java" + ); + return f; + } + + +} Property changes on: trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java ___________________________________________________________________ Added: svn:keywords + HeadURL Id Date Revision Author Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.junit.Test; Deleted: trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,132 +0,0 @@ -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; - -/** - * Tests the {@link UpdateLicenseMojo}. - * - * @author tchemit <chemit@codelutin.com> - * @since 2.1 - */ -public class UpdateLicenseMojoTest extends AbstractMojoTest<UpdateLicenseMojo> { - - @Override - protected String getGoalName(String methodName) { - return "update-license"; - } - - @Test - public void addLicense() throws Exception { - - File f = getMyBeanFile("addLicense"); - - UpdateLicenseMojo mojo = getMojo(); - String content; - -// content = PluginHelper.readAsString(f, mojo.getEncoding()); -// -// // check no header -// checkPattern(f, content, "Copyright (C) 2010", false); -// checkPattern(f, content, "Project name : maven-license-plugin-java", false); -// checkPattern(f, content, "Organization is CodeLutin", false); - - mojo.execute(); - Assert.assertEquals(1, mojo.getProcessedFiles().size()); - - content = PluginHelper.readAsString(f, mojo.getEncoding()); - - // check header - checkPattern(f, content, "Copyright (C) 2010", true); - checkPattern(f, content, "Project name : maven-license-plugin-java", true); - checkPattern(f, content, "Organization is CodeLutin", true); - } - - @Test - public void updateLicense() throws Exception { - - File f = getMyBeanFile("updateLicense"); - - UpdateLicenseMojo mojo = getMojo(); - - String content; - - content = PluginHelper.readAsString(f, mojo.getEncoding()); - - // check header - checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); - checkPattern(f, content, "License Test :: do NOT update!", true); -// checkPattern(f, content, "Fake to be removed!", true); - - mojo.execute(); - Assert.assertEquals(1, mojo.getProcessedFiles().size()); - - content = PluginHelper.readAsString(f, mojo.getEncoding()); - - // check header (description + copyright) does not changed - checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); - checkPattern(f, content, "License Test :: do NOT update!", true); - - // check license changed - checkPattern(f, content, "Fake to be removed!", false); - } - - @Test - public void ignoreLicense() throws Exception { - - File f = getMyBeanFile("ignoreLicense"); - - UpdateLicenseMojo mojo = getMojo(); - - String content; - - content = PluginHelper.readAsString(f, mojo.getEncoding()); - - // check header - checkPattern(f, content, "Copyright (C) 2000 Codelutin Do not update!", true); - checkPattern(f, content, " * %" + "%Ignore-License", true); - checkPattern(f, content, "yet another license", true); - checkPattern(f, content, "NEVER_FINd_ME!", false); - - mojo.execute(); - Assert.assertEquals(1, mojo.getProcessedFiles().size()); - - content = PluginHelper.readAsString(f, mojo.getEncoding()); - - // 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, "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", - "test-classes", - "org", - "nuiton", - "license", - "plugin", - "updateLicenseMojoTest", - testName, - "src", - "MyBean.java" - ); - return f; - } - - -} Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java 2010-04-10 15:49:00 UTC (rev 1734) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin; import org.junit.Assert; @@ -60,6 +88,7 @@ // since we can not ensure order of copy test resources PluginHelper.setLastModified(mojo.getProject().getFile(), 0); + mojo.setVerbose(true); // then executing the mojo, will do NOT change the licence file mojo.execute(); @@ -69,7 +98,7 @@ // force to override the license file mojo.setForce(true); - + mojo.setVerbose(false); mojo.execute(); t1 = licenseFile.lastModified(); @@ -88,6 +117,8 @@ // since we can not ensure order of copy test resources PluginHelper.setLastModified(mojo.getProject().getFile(), 0); + mojo.setVerbose(true); + // then executing the mojo, will do NOT change the licence file mojo.execute(); @@ -97,6 +128,7 @@ // force to override the license file mojo.setForce(true); + mojo.setVerbose(false); mojo.execute(); t1 = licenseFile.lastModified(); @@ -113,4 +145,4 @@ Assert.assertTrue(mojo.isSkip()); } -} \ No newline at end of file +} 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.header.transformer; import org.junit.After; @@ -53,6 +81,23 @@ model2 = null; } + + @Test(expected = IllegalStateException.class) + public void testIllegalTransformer() throws Exception { + + new AbstractFileHeaderTransformer("name", "description", "commentPrefix", "commentEndtag", "commentPrefix") { + + }; + } + + @Test(expected = IllegalStateException.class) + public void testIllegalTransformer2() throws Exception { + + new AbstractFileHeaderTransformer("name", "description", "commentstartTag", "commentPrefix", "commentPrefix") { + + }; + } + @Test public void testCopyrightPattern() throws Exception { String actual; 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + 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-10 15:49:00 UTC (rev 1734) +++ trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,3 +1,31 @@ +/* + * #%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% + */ + package org.nuiton.license.plugin.model; import org.junit.Assert; Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/src/MyBean.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/src/MyBean.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -1,4 +1,4 @@ -package org.nuiton.license.plugin.updateLicenseMojoTest.addLicense.src; +package org.nuiton.license.plugin.updateFileHeaderMojoTest.addLicense.src; /** * this class has no license, a new default one will be added. Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -18,19 +18,18 @@ <artifactId>maven-license-plugin</artifactId> <configuration> <descriptor> - target/test-classes/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/project.xml + target/test-classes/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/project.xml </descriptor> <projectName>Project name : maven-license-plugin-java</projectName> <organizationName>Organization is CodeLutin</organizationName> <inceptionYear>2010</inceptionYear> - <ignoreTag>NEVER_FINd_ME!</ignoreTag> + <ignoreTag/> <encoding>UTF-8</encoding> - <verbose>true</verbose> </configuration> <executions> <execution> <goals> - <goal>update-license</goal> + <goal>update-file-header</goal> </goals> </execution> </executions> Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,20 @@ +<?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> + <licenseName>lgpl_v3</licenseName> + <fileSets> + <fileSet> + <headerType>java</headerType> + <basedir>all/src</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + </fileSets> + </licenseSet> + </licenseSets> +</project> Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Add.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Add.java (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Add.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,10 @@ +package org.nuiton.license.plugin.updateFileHeaderMojoTest.all.src; + +/** + * this class has no license, a new default one will be added. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class Add { +} \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Add.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Fail.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Fail.java (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Fail.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,20 @@ +/* + * #%L + * License Test :: do NOT update! + * -- + * Copyright (C) 2000 Codelutin do NOT update! + * -- + * License content do NOT update! + * #L% + */ +package org.nuiton.license.plugin.updateFileHeaderMojoTest.all.src; + +/** + * this class has a failed header (section delimiters), nothing will be + * modified. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class Fail { +} \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Fail.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Ignore.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Ignore.java (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Ignore.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,17 @@ +/* + * %%Ignore-License + * + * yet another license + * + * Copyright (C) 2000 Codelutin Do not update! + */ +package org.nuiton.license.plugin.updateFileHeaderMojoTest.all.src; + +/** + * this class has no license, a new default one will be added. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class Ignore { +} \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Ignore.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Update.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Update.java (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Update.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,20 @@ +/* + * #%L + * License Test :: do NOT update! + * %% + * Copyright (C) 2000 Codelutin do NOT update! + * %% + * 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.updateFileHeaderMojoTest.all.src; + +public class Update { +} \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Update.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,39 @@ +<?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>Update License to MyBean</name> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <descriptor> + target/test-classes/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml + </descriptor> + <projectName>Project name : maven-license-plugin-java</projectName> + <organizationName>Organization is CodeLutin</organizationName> + <inceptionYear>2010</inceptionYear> + <ignoreTag>%%Ignore-License</ignoreTag> + <encoding>UTF-8</encoding> + </configuration> + <executions> + <execution> + <goals> + <goal>update-file-header</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/updateFileHeaderMojoTest/all.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,20 @@ +<?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> + <licenseName>lgpl_v3</licenseName> + <fileSets> + <fileSet> + <headerType>java</headerType> + <basedir>failLicense/src</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + </fileSets> + </licenseSet> + </licenseSets> +</project> Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/src/MyBean.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/src/MyBean.java (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/src/MyBean.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,20 @@ +/* + * #%L + * License Test :: do NOT update! + * -- + * Copyright (C) 2000 Codelutin do NOT update! + * -- + * License content do NOT update! + * #L% + */ +package org.nuiton.license.plugin.updateFileHeaderMojoTest.failLicense.src; + +/** + * this class has a failed header (section delimiters), nothing will be + * modified. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class MyBean { +} \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/src/MyBean.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,39 @@ +<?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> + <descriptor> + target/test-classes/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml + </descriptor> + <projectName>NEVER_FINd_ME!</projectName> + <organizationName>NEVER_FINd_ME!</organizationName> + <inceptionYear>2010</inceptionYear> + <ignoreTag>%%Ignore-License</ignoreTag> + <encoding>UTF-8</encoding> + </configuration> + <executions> + <execution> + <goals> + <goal>update-file-header</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/updateFileHeaderMojoTest/failLicense.xml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/src/MyBean.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/src/MyBean.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -5,7 +5,7 @@ * * Copyright (C) 2000 Codelutin Do not update! */ -package org.nuiton.license.plugin.updateLicenseMojoTest.ignoreLicense.src; +package org.nuiton.license.plugin.updateFileHeaderMojoTest.ignoreLicense.src; /** * this class has no license, a new default one will be added. Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -18,19 +18,18 @@ <artifactId>maven-license-plugin</artifactId> <configuration> <descriptor> - target/test-classes/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/project.xml + target/test-classes/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/project.xml </descriptor> <projectName>NEVER_FINd_ME!</projectName> <organizationName>NEVER_FINd_ME!</organizationName> <inceptionYear>2010</inceptionYear> <ignoreTag>%%Ignore-License</ignoreTag> <encoding>UTF-8</encoding> - <verbose>true</verbose> </configuration> <executions> <execution> <goals> - <goal>update-license</goal> + <goal>update-file-header</goal> </goals> </execution> </executions> Copied: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/skip.xml (from rev 1733, trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml) =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/skip.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/skip.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -0,0 +1,32 @@ +<?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> + </configuration> + <executions> + <execution> + <goals> + <goal>update-file-header</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/src/MyBean.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/src/MyBean.java 2010-04-10 20:45:56 UTC (rev 1735) @@ -14,7 +14,7 @@ * @author tchemit <chemit@codelutin.com> * @since 2.1 */ -package org.nuiton.license.plugin.updateLicenseMojoTest.updateLicense.src; +package org.nuiton.license.plugin.updateFileHeaderMojoTest.updateLicense.src; public class MyBean { } Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense.xml 2010-04-09 23:52:31 UTC (rev 1732) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense.xml 2010-04-10 20:45:56 UTC (rev 1735) @@ -18,19 +18,18 @@ <artifactId>maven-license-plugin</artifactId> <configuration> <descriptor> - target/test-classes/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/project.xml + target/test-classes/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/project.xml </descriptor> <projectName>Project name : maven-license-plugin-java</projectName> <organizationName>Organization is CodeLutin</organizationName> <inceptionYear>2010</inceptionYear> <ignoreTag>NEVER_FINd_ME!</ignoreTag> <encoding>UTF-8</encoding> - <verbose>true</verbose> </configuration> <executions> <execution> <goals> - <goal>update-license</goal> + <goal>update-file-header</goal> </goals> </execution> </executions>
participants (1)
-
tchemit@users.nuiton.org