Maven-license-plugin-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- 268 discussions
Author: tchemit
Date: 2010-04-12 13:39:55 +0200 (Mon, 12 Apr 2010)
New Revision: 1741
Log:
[maven-release-plugin] prepare release maven-license-plugin-2.1
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-12 11:36:18 UTC (rev 1740)
+++ trunk/pom.xml 2010-04-12 11:39:55 UTC (rev 1741)
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -16,7 +14,7 @@
</parent>
<artifactId>maven-license-plugin</artifactId>
- <version>2.1-SNAPSHOT</version>
+ <version>2.1</version>
<dependencies>
@@ -277,9 +275,9 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/maven-license-plugin/trunk</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/tags/maven-license-p…</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/tags/maven-license-p…</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/maven-license-plugin/tags/maven-l…</url>
</scm>
<!-- ************************************************************* -->
@@ -465,11 +463,7 @@
<phase>pre-site</phase>
<configuration>
<tasks>
- <copy verbose="${maven.verbose}"
- failonerror="false"
- overwrite="false"
- file="target/generated-site/xsd/licenseProjectDescriptor-${mdoVersion}.xsd"
- tofile="target/site/licenseProjectDescriptor-${mdoVersion}.xsd"/>
+ <copy verbose="${maven.verbose}" failonerror="false" overwrite="false" file="target/generated-site/xsd/licenseProjectDescriptor-${mdoVersion}.xsd" tofile="target/site/licenseProjectDescriptor-${mdoVersion}.xsd" />
</tasks>
</configuration>
<goals>
1
0
Author: tchemit
Date: 2010-04-12 13:36:18 +0200 (Mon, 12 Apr 2010)
New Revision: 1740
Log:
use stable release of maven-helper-plugin
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-12 11:15:15 UTC (rev 1739)
+++ trunk/pom.xml 2010-04-12 11:36:18 UTC (rev 1740)
@@ -293,7 +293,7 @@
<processor.version>1.0.2</processor.version>
<!-- TODO Remove this when mavenpom greater than 2.1 -->
- <helper.version>1.2.3-SNAPSHOT</helper.version>
+ <helper.version>1.2.3</helper.version>
<!-- version of project license descriptor model -->
<mdoVersion>1.0.0</mdoVersion>
1
0
12 Apr '10
Author: tchemit
Date: 2010-04-12 13:15:15 +0200 (Mon, 12 Apr 2010)
New Revision: 1739
Log:
improve log
Modified:
trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java
Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-04-12 11:02:13 UTC (rev 1738)
+++ trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-04-12 11:15:15 UTC (rev 1739)
@@ -309,8 +309,8 @@
String licenseName = header.getLicenseName();
License license = getLicense(licenseName);
- getLog().info("process header '" + header.getCommentStyle() + "'");
- getLog().info("using " + license.getDescription());
+ getLog().info("Process header '" + header.getCommentStyle() + "'");
+ getLog().info(" - using " + license.getDescription());
// use header transformer according to comment style given in header
setTransformer(getTransformer(header.getCommentStyle()));
@@ -335,8 +335,8 @@
File basedir = new File(getProject().getBasedir(),
fileSet.getBasedir());
- if (isVerbose()) {
- getLog().info("process file set with basedir : " + basedir);
+ if (getLog().isDebugEnabled()) {
+ getLog().debug(" - process file set with basedir : " + basedir);
}
List<String> includes = fileSet.getIncludes();
@@ -375,11 +375,11 @@
protected void processFileEntry(File entryBasedir,
String[] paths) throws IOException {
- getLog().info(paths.length + " file(s) to treate in " + entryBasedir);
+ getLog().info(" - " + paths.length + " file(s) to treate in " + entryBasedir);
for (String path : paths) {
File file = new File(entryBasedir, path);
if (getProcessedFiles().contains(file)) {
- getLog().info("skip already processed file " + file);
+ getLog().info(" - skip already processed file " + file);
continue;
}
@@ -426,10 +426,10 @@
protected boolean processFile(File file,
File processFile) throws IOException {
- getLog().debug("will process into file " + processFile);
- if (isVerbose()) {
- getLog().info("process file " + file);
+ if (getLog().isDebugEnabled()) {
+ getLog().debug(" - process file " + file);
+ getLog().debug(" - will process into file " + processFile);
}
String content;
@@ -449,7 +449,7 @@
//check that file is not marked to be ignored
if (content.contains(getIgnoreTag())) {
getLog().info(
- "ignore file (detected " + getIgnoreTag() + ") " + file);
+ " - ignore file (detected " + getIgnoreTag() + ") " + file);
FileState.ignore.addFile(file, getResult());
@@ -477,7 +477,7 @@
if (processor.isTouched()) {
if (isVerbose()) {
- getLog().info("header was updated for " + file);
+ getLog().info(" - header was updated for " + file);
}
if (processor.isModified()) {
@@ -505,7 +505,7 @@
// no header at all, add a new header
- getLog().info("adding license header on file " + file);
+ getLog().info(" - adding license header on file " + file);
//FIXME-TC-20100409 form xml files must add header after a xml prolog line
content = getTransformer().addHeader(
@@ -533,7 +533,7 @@
}
if (isVerbose()) {
- getLog().debug("backup original file " + file);
+ getLog().debug(" - backup original file " + file);
}
renameFile(file, backupFile);
1
0
r1738 - in trunk/src: main/java/org/nuiton/license/plugin/header/transformer test/java/org/nuiton/license/plugin/header/transformer
by tchemit@users.nuiton.org 12 Apr '10
by tchemit@users.nuiton.org 12 Apr '10
12 Apr '10
Author: tchemit
Date: 2010-04-12 13:02:13 +0200 (Mon, 12 Apr 2010)
New Revision: 1738
Log:
update header + add test
Added:
trunk/src/test/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformerTest.java
Modified:
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java
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-12 11:01:09 UTC (rev 1737)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-12 11:02:13 UTC (rev 1738)
@@ -88,4 +88,4 @@
}
return result;
}
-}
\ No newline at end of file
+}
Added: trunk/src/test/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformerTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformerTest.java (rev 0)
+++ trunk/src/test/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformerTest.java 2010-04-12 11:02:13 UTC (rev 1738)
@@ -0,0 +1,80 @@
+/*
+ * #%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;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the {@link XmlFileHeaderTransformer}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+public class XmlFileHeaderTransformerTest {
+
+ protected XmlFileHeaderTransformer transformer;
+
+ private static final String CONTENT = "content";
+
+ private static final String HEADER = "header";
+
+ @Before
+ public void setUp() {
+ transformer = new XmlFileHeaderTransformer();
+ }
+
+ @After
+ public void tearDown() {
+ transformer = null;
+ }
+
+ @Test
+ public void testAddHeaderWithNoProlog() {
+ String header = HEADER;
+ String content = CONTENT;
+ String result = transformer.addHeader(header, content);
+ Assert.assertEquals(header + content, result);
+ }
+
+ @Test
+ public void testAddHeaderWithProlog() {
+ String header = HEADER;
+ String prolog = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+ String content = prolog + CONTENT;
+ String result = transformer.addHeader(header, content);
+ Assert.assertEquals(prolog + '\n' + header + CONTENT, result);
+
+ header = HEADER;
+ content = " " + prolog + CONTENT;
+ result = transformer.addHeader(header, content);
+ Assert.assertEquals(" " + prolog + '\n' + header + CONTENT, result);
+ }
+}
Property changes on: trunk/src/test/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformerTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
1
0
Author: tchemit
Date: 2010-04-12 13:01:09 +0200 (Mon, 12 Apr 2010)
New Revision: 1737
Log:
- update changelog.txt
- update doc
- deal with xml prolog for new header on xml
- reformat doc
- finalize documentation
- add javadoc package.html
- add optimized license project descriptor (add single tags and deal with them)
Added:
trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessorConfiguration.java
trunk/src/main/java/org/nuiton/license/plugin/header/InvalideFileHeaderException.java
trunk/src/main/java/org/nuiton/license/plugin/header/UpdateFileHeaderFilter.java
trunk/src/main/java/org/nuiton/license/plugin/header/generator/package.html
trunk/src/main/java/org/nuiton/license/plugin/header/package.html
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/package.html
trunk/src/main/java/org/nuiton/license/plugin/model/descriptor/
trunk/src/main/java/org/nuiton/license/plugin/model/descriptor/package.html
trunk/src/main/java/org/nuiton/license/plugin/model/package.html
trunk/src/main/java/org/nuiton/license/plugin/package.html
Modified:
trunk/changelog.txt
trunk/pom.xml
trunk/src/it/update-file-header/src/license/project.xml
trunk/src/it/update-project-license/src/license/project.xml
trunk/src/license/project.xml
trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java
trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java
trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java
trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.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/transformer/AbstractFileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java
trunk/src/main/mdo/descriptor.mdo
trunk/src/main/resources/META-INF/licenses/gpl_v1/header.txt
trunk/src/main/resources/META-INF/licenses/gpl_v2/header.txt
trunk/src/main/resources/META-INF/licenses/gpl_v3/header.txt
trunk/src/main/resources/META-INF/licenses/licenses.properties
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/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java
trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/project.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/project.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/project.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/changelog.txt 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,3 +1,38 @@
+maven-license-plugin (2.1) stable; urgency=high
+
+ * Anomalie #488: MUST insert xml header after prolog in found
+ * Evolution #452: Reformat code to respect code formatting
+ * Evolution #454: Use maven-helper-plugin 1.2.3
+ * Evolution #456: Separate Copyright from license content in header
+ * Evolution #457: Add a new header format to be ignored by updater goal for specific license
+ * Evolution #458: Add a migration mode from old format to new one
+ * Evolution #461: Deprecates update-header goal and introduces update-license goal
+ * Evolution #462: Add new licenses in repository
+ * Evolution #465: Add AGPL license
+ * Evolution #478: Deprecates LicenseHeaderGenerator api
+ * Evolution #479: Introduce update-project-license goal (replace add-license goal)
+ * Evolution #486: Use junit 4.8.1
+
+ -- chemit -- Mon, 12 Apr 2010 12:32:09 +0200
+
+maven-license-plugin (2.0.2) stable; urgency=high
+
+ * Anomalie #267: can not configure compileSourceRoots on update-header goal
+ * Evolution #268: Add apt license generator
+
+ -- chemit -- 24/01/2010
+
+maven-license-plugin (2.0.1) stable; urgency=high
+
+ * Anomali e #250: Change mojo properties expression from helper.XXX to license.XXX
+ * Evolution #192: Use mavenpom4redmine 2.0.2
+ * Evolution #193: Use maven-helper-plugin 1.2.0 with revisited AbstractPlugin api
+ * Evolution #247: generate files into target/generated-sources/licene instead of target/generated-sources/resources
+ * Evolution #248: Rename Mojo classes from Plugin suffix to Mojo suffix
+ * Evolution #249: Remove ServiceLoader mecanism
+
+ -- chemit -- 21/01/2010
+
maven-license-plugin (2.0.0) stable; urgency=high
* Evolution #31: add some documentation on site
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/pom.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -238,7 +238,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.7</version>
+ <version>4.8.1</version>
<scope>test</scope>
</dependency>
@@ -277,15 +277,9 @@
<!-- Source control management. -->
<scm>
- <connection>
- scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk
- </connection>
- <developerConnection>
- scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk
- </developerConnection>
- <url>
- http://www.nuiton.org/repositories/browse/maven-license-plugin/trunk
- </url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/maven-license-plugin/trunk</url>
</scm>
<!-- ************************************************************* -->
@@ -368,42 +362,6 @@
</executions>
</plugin>
- <plugin>
- <artifactId>maven-plugin-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>helpmojo</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <!-- TC-20100117 : 1.3 does not works here -->
- <version>1.2</version>
- <executions>
- <!-- copy generated xsd to site -->
- <execution>
- <id>copy licenProject.xsd</id>
- <phase>pre-site</phase>
- <configuration>
- <tasks>
- <copy verbose="${maven.verbose}"
- failonerror="false"
- overwrite="false"
- file="target/generated-site/xsd/licenseProject-1.0.0.xsd"
- tofile="target/site/licenseProject-1.0.0.xsd"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
</plugins>
<pluginManagement>
@@ -431,23 +389,6 @@
</build>
- <reporting>
- <plugins>
-
- <plugin>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>2.5.1</version>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.3</version>
- </plugin>
-
- </plugins>
- </reporting>
-
<profiles>
<profile>
@@ -468,8 +409,7 @@
<pomInclude>**/pom.xml</pomInclude>
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
- <localRepositoryPath>${basedir}/target/local-repo
- </localRepositoryPath>
+ <localRepositoryPath>${basedir}/target/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
<!--<debug>true</debug>-->
@@ -489,6 +429,90 @@
</build>
</profile>
+ <!-- perform only on a release stage when using the maven-release-plugin -->
+ <profile>
+ <id>release-profile</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+
+ <build>
+
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <!-- TC-20100117 : 1.3 does not works here -->
+ <version>1.2</version>
+ <executions>
+ <!-- copy generated xsd to site -->
+ <execution>
+ <id>copy-descriptor-xsd</id>
+ <phase>pre-site</phase>
+ <configuration>
+ <tasks>
+ <copy verbose="${maven.verbose}"
+ failonerror="false"
+ overwrite="false"
+ file="target/generated-site/xsd/licenseProjectDescriptor-${mdoVersion}.xsd"
+ tofile="target/site/licenseProjectDescriptor-${mdoVersion}.xsd"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ </profile>
+
+ <!-- perform only on a release stage when using the maven-release-plugin -->
+ <profile>
+ <id>reporting</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+
+ <reporting>
+
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.3</version>
+ </plugin>
+
+ </plugins>
+ </reporting>
+
+ </profile>
</profiles>
</project>
Modified: trunk/src/it/update-file-header/src/license/project.xml
===================================================================
--- trunk/src/it/update-file-header/src/license/project.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/it/update-file-header/src/license/project.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,20 +1,13 @@
<?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">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
- <licenseName>gpl_v3</licenseName>
- <fileSets>
- <fileSet>
- <headerType>java</headerType>
- <basedir>src/main/java</basedir>
- <includes>
- <include>**/*.java</include>
- </includes>
- </fileSet>
- </fileSets>
- </licenseSet>
- </licenseSets>
+ <header>
+ <commentStyle>java</commentStyle>
+ <fileSet>
+ <basedir>src/main/java</basedir>
+ <include>**/*.java</include>
+ </fileSet>
+ </header>
</project>
Modified: trunk/src/it/update-project-license/src/license/project.xml
===================================================================
--- trunk/src/it/update-project-license/src/license/project.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/it/update-project-license/src/license/project.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,19 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
- <fileSets>
- <fileSet>
- <headerType>java</headerType>
- <basedir>src/main/java</basedir>
- <includes>
- <include>**/*.java</include>
- </includes>
- </fileSet>
- </fileSets>
- </licenseSet>
- </licenseSets>
</project>
Modified: trunk/src/license/project.xml
===================================================================
--- trunk/src/license/project.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/license/project.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,53 +1,45 @@
<?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">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>lgpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
- <fileSets>
- <fileSet>
- <headerType>java</headerType>
+ <headers>
+
+ <header>
+ <commentStyle>java</commentStyle>
+ <fileSets>
+ <fileSet>
<basedir>src/main/java</basedir>
- <includes>
- <include>**/*.java</include>
- </includes>
+ <include>**/*.java</include>
</fileSet>
-
- <fileSet>
- <headerType>java</headerType>
+ <fileSet>
<basedir>src/test/java</basedir>
- <includes>
- <include>**/*.java</include>
- </includes>
+ <include>**/*.java</include>
</fileSet>
-
<fileSet>
- <headerType>java</headerType>
<basedir>src/target/generated-sources/modello</basedir>
- <includes>
- <include>**/*.java</include>
- </includes>
+ <include>**/*.java</include>
</fileSet>
+ </fileSets>
+ </header>
+ <header>
+ <commentStyle>rst</commentStyle>
<fileSet>
- <headerType>rst</headerType>
<basedir>src/site</basedir>
- <includes>
- <include>**/*.rst</include>
- </includes>
+ <include>**/*.rst</include>
</fileSet>
+ </header>
+ <header>
+ <commentStyle>xml</commentStyle>
<fileSet>
- <headerType>xml</headerType>
<basedir>src/site</basedir>
- <includes>
- <include>**/*.xml</include>
- </includes>
+ <include>**/*.xml</include>
</fileSet>
+ </header>
- </fileSets>
- </licenseSet>
- </licenseSets>
+ </headers>
+
</project>
Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -30,14 +30,15 @@
import org.apache.commons.lang.StringUtils;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
import org.nuiton.license.plugin.header.FileHeader;
import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer;
import org.nuiton.license.plugin.model.License;
import org.nuiton.license.plugin.model.LicenseStore;
-import org.nuiton.license.plugin.model.project.FileSet;
-import org.nuiton.license.plugin.model.project.LicenseProject;
-import org.nuiton.license.plugin.model.project.LicenseSet;
-import org.nuiton.license.plugin.model.project.io.xpp3.LicenseProjectXpp3Reader;
+import org.nuiton.license.plugin.model.descriptor.FileSet;
+import org.nuiton.license.plugin.model.descriptor.Header;
+import org.nuiton.license.plugin.model.descriptor.LicenseProjectDescriptor;
+import org.nuiton.license.plugin.model.descriptor.io.xpp3.LicenseProjectDescriptorXpp3Reader;
import java.io.File;
import java.io.FileReader;
@@ -91,9 +92,16 @@
private LicenseStore licenseStore;
/** descriptor of project */
- private LicenseProject licenseProject;
+ private LicenseProjectDescriptor licenseProjectDescriptor;
- /** @return {@code true} if goal will not be executed */
+ /**
+ * When is sets to {@code true}, will skip execution.
+ * <p/>
+ * This will take effects in method {@link #checkSkip()}.
+ * So the method {@link #doAction()} will never be invoked.
+ *
+ * @return {@code true} if goal will not be executed
+ */
public abstract boolean isSkip();
/**
@@ -109,6 +117,10 @@
getLog().info("skip flag is on, will skip goal.");
return false;
}
+ if (!getDescriptor().exists()) {
+ getLog().warn("skip - could not find descriptor " + getDescriptor());
+ return false;
+ }
return super.checkSkip();
}
@@ -124,11 +136,41 @@
setLicenseStore(licenseStore);
// load project descriptor
- LicenseProject licenseProject = null;
- FileReader reader = new FileReader(getDescriptor());
+ File descriptorFile = new File(getDescriptor().getAbsolutePath());
+ if (!descriptorFile.exists()) {
+
+ // try to find the file in the direct parent module
+ MavenProject mavenProject = getProject().getParent();
+ if (mavenProject != null) {
+
+ File basedir = getProject().getBasedir();
+
+ // try with the parent
+ String path = descriptorFile.getAbsolutePath().substring(
+ basedir.getAbsolutePath().length() + 1);
+ setDescriptor(new File(mavenProject.getBasedir() +
+ File.separator + path));
+ if (isVerbose()) {
+ getLog().info("try in parent module " + getDescriptor());
+ }
+
+ }
+ descriptorFile = new File(getDescriptor().getAbsolutePath());
+ }
+
+ if (!descriptorFile.exists()) {
+// throw new MojoFailureException(
+// "could not find descriptor " + descriptorFile);
+ return;
+ }
+
+ getLog().info("Loading descriptor " + descriptorFile);
+ LicenseProjectDescriptor licenseProject = null;
+ FileReader reader = new FileReader(descriptorFile);
try {
- licenseProject = new LicenseProjectXpp3Reader().read(reader);
- setLicenseProject(licenseProject);
+ licenseProject =
+ new LicenseProjectDescriptorXpp3Reader().read(reader);
+ setLicenseProjectDescriptor(licenseProject);
} finally {
reader.close();
}
@@ -136,9 +178,9 @@
// check that license project is sane (known licenses + header types)
// + populate default license name in LicenseSet (with main License) if
// none given for licenseSet
- validateProjectFile(licenseProject,
- licenseStore,
- getTransformers()
+ validateLicenseProjectDescriptor(licenseProject,
+ licenseStore,
+ getTransformers()
);
}
@@ -162,8 +204,8 @@
return licenseStore;
}
- public LicenseProject getLicenseProject() {
- return licenseProject;
+ public LicenseProjectDescriptor getLicenseProjectDescriptor() {
+ return licenseProjectDescriptor;
}
public void setKeepBackup(boolean keepBackup) {
@@ -178,7 +220,8 @@
this.licenseResolver = licenseResolver;
}
- public void setTransformers(Map<String, FileHeaderTransformer> transformers) {
+ public void setTransformers(
+ Map<String, FileHeaderTransformer> transformers) {
this.transformers = transformers;
}
@@ -187,13 +230,14 @@
}
- public void setLicenseProject(LicenseProject licenseProject) {
- this.licenseProject = licenseProject;
+ public void setLicenseProjectDescriptor(
+ LicenseProjectDescriptor licenseProjectDescriptor) {
+ this.licenseProjectDescriptor = licenseProjectDescriptor;
}
public License getMainLicense()
throws IllegalArgumentException, IllegalStateException {
- LicenseProject licenseProject = getLicenseProject();
+ LicenseProjectDescriptor licenseProject = getLicenseProjectDescriptor();
if (licenseProject == null) {
throw new IllegalStateException("No license project initialized!");
}
@@ -209,7 +253,8 @@
public License getLicense(String licenseName)
throws IllegalArgumentException, IllegalStateException {
if (StringUtils.isEmpty(licenseName)) {
- throw new IllegalArgumentException("licenseName can not be null, nor empty");
+ throw new IllegalArgumentException(
+ "licenseName can not be null, nor empty");
}
LicenseStore licenseStore = getLicenseStore();
if (licenseStore == null) {
@@ -222,7 +267,8 @@
public FileHeaderTransformer getTransformer(String transformerName)
throws IllegalArgumentException, IllegalStateException {
if (StringUtils.isEmpty(transformerName)) {
- throw new IllegalArgumentException("transformerName can not be null, nor empty!");
+ throw new IllegalArgumentException(
+ "transformerName can not be null, nor empty!");
}
Map<String, FileHeaderTransformer> transformers = getTransformers();
if (transformers == null) {
@@ -290,8 +336,8 @@
return result;
}
- protected void validateProjectFile(
- LicenseProject licenseProject,
+ protected void validateLicenseProjectDescriptor(
+ LicenseProjectDescriptor licenseProjectDescriptor,
LicenseStore licenseStore,
Map<String, FileHeaderTransformer> transformers)
throws MojoFailureException {
@@ -299,19 +345,35 @@
List<String> licenseNames = Arrays.asList(licenseStore.getLicenseNames());
// check licenses is known
- String mainLicense = licenseProject.getMainLicense();
+ String mainLicense = licenseProjectDescriptor.getMainLicense();
if (licenseStore.getLicense(mainLicense) == null) {
throw new MojoFailureException(
"main license '" + mainLicense +
"' is unknown, use one of " + licenseNames);
}
- for (LicenseSet licenseSet : licenseProject.getLicenseSets()) {
- String licenseName = licenseSet.getLicenseName();
+ Header singleHeader = licenseProjectDescriptor.getHeader();
+ if (singleHeader != null) {
+
+ // add it to set (and remove it from single)
+ licenseProjectDescriptor.addHeader(singleHeader);
+ licenseProjectDescriptor.setHeader(null);
+ }
+
+ for (Header header : licenseProjectDescriptor.getHeaders()) {
+
+ String headerType = header.getCommentStyle();
+
+ if (getTransformer(headerType) == null) {
+ throw new MojoFailureException(
+ "headerType '" + headerType +
+ "' is unknown, use one of " + transformers.keySet());
+ }
+ String licenseName = header.getLicenseName();
if (StringUtils.isEmpty(licenseName)) {
// use the main license
- licenseSet.setLicenseName(mainLicense);
+ header.setLicenseName(mainLicense);
} else {
// check license name
@@ -322,15 +384,30 @@
}
}
- // check header types (for each file set)
- for (FileSet fileSet : licenseSet.getFileSets()) {
- String headerType = fileSet.getHeaderType();
+ FileSet singleFileSet = header.getFileSet();
+ if (singleFileSet != null) {
- if (getTransformer(headerType) == null) {
- throw new MojoFailureException(
- "headerType '" + headerType +
- "' is unknown, use one of " + transformers.keySet());
+ // add it to set (and remove it from single)
+ header.addFileSet(singleFileSet);
+ header.setFileSet(null);
+ }
+ for (FileSet fileSet : header.getFileSets()) {
+
+ String singleInclude = fileSet.getInclude();
+ if (singleInclude != null) {
+
+ // add it to set (and remove it from single)
+ fileSet.addInclude(singleInclude);
+ fileSet.setInclude(null);
}
+
+ String singleExclude = fileSet.getExclude();
+ if (singleExclude != null) {
+
+ // add it to set (and remove it from single)
+ fileSet.addExclude(singleExclude);
+ fileSet.setExclude(null);
+ }
}
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -32,8 +32,10 @@
import org.apache.maven.plugin.MojoFailureException;
import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
/**
* Displays all the available comment style to box file headers.
@@ -70,22 +72,35 @@
@Override
public void doAction() throws MojoExecutionException, MojoFailureException {
- StringBuilder buffer = new StringBuilder("\n");
- buffer.append("\n\n-------------------------------------------------------------------------------\n");
- buffer.append(" maven-license-plugin\n");
- buffer.append("-------------------------------------------------------------------------------\n\n");
+ StringBuilder buffer = new StringBuilder();
+ if (isVerbose()) {
+ buffer.append("\n\n-------------------------------------------------------------------------------\n");
+ buffer.append(" maven-license-plugin\n");
+ buffer.append("-------------------------------------------------------------------------------\n\n");
+ }
+ List<String> names = new ArrayList<String>(transformers.keySet());
+ Collections.sort(names);
- buffer.append("List of available comment style:\n\n");
- for (Entry<String, FileHeaderTransformer> e : transformers.entrySet()) {
- FileHeaderTransformer generator = e.getValue();
- buffer.append(" - ");
- buffer.append(e.getKey());
- buffer.append(" : ");
- buffer.append(generator.getDescription());
- buffer.append("\n");
+ int maxLength = 0;
+ for (String name : names) {
+ if (name.length() > maxLength) {
+ maxLength = name.length();
+ }
+ }
+
+ String pattern = " - %1$-" + maxLength + "s : %2$s\n";
+
+ buffer.append("List of available comment styles:\n\n");
+ for (String transformerName : names) {
+ FileHeaderTransformer transformer =
+ transformers.get(transformerName);
+ buffer.append(String.format(pattern,
+ transformerName,
+ transformer.getDescription())
+ );
if (detail) {
buffer.append("\n example : \n");
- buffer.append(generator.boxComment("header", true));
+ buffer.append(transformer.boxComment("header", true));
buffer.append('\n');
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -34,6 +34,9 @@
import org.nuiton.license.plugin.model.LicenseStore;
import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
/**
* Display all available licenses.
@@ -75,18 +78,31 @@
@Override
public void doAction() throws MojoExecutionException, MojoFailureException {
StringBuilder buffer = new StringBuilder();
- buffer.append("\n\n-------------------------------------------------------------------------------\n");
- buffer.append(" maven-license-plugin\n");
- buffer.append("-------------------------------------------------------------------------------\n\n");
+
+ if (isVerbose()) {
+ buffer.append("\n\n-------------------------------------------------------------------------------\n");
+ buffer.append(" maven-license-plugin\n");
+ buffer.append("-------------------------------------------------------------------------------\n\n");
+ }
buffer.append("Available licenses :\n\n");
- for (License license : licenseStore.getLicenses()) {
- String licenseName = license.getName();
- buffer.append(" * ");
- buffer.append(licenseName);
- buffer.append(" : ");
- buffer.append(license.getDescription());
- buffer.append('\n');
+ List<String> names = Arrays.asList(licenseStore.getLicenseNames());
+
+ int maxLength = 0;
+ for (String name : names) {
+ if (name.length() > maxLength) {
+ maxLength = name.length();
+ }
+ }
+ Collections.sort(names);
+
+ String pattern = " * %1$-" + maxLength + "s : %2$s\n";
+ for (String licenseName : names) {
+ License license = licenseStore.getLicense(licenseName);
+ buffer.append(String.format(pattern,
+ licenseName,
+ license.getDescription())
+ );
if (detail) {
try {
buffer.append("\n");
Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -29,13 +29,11 @@
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.*;
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.license.plugin.model.descriptor.FileSet;
+import org.nuiton.license.plugin.model.descriptor.Header;
import org.nuiton.plugin.PluginHelper;
import java.io.File;
@@ -57,7 +55,7 @@
* @goal update-file-header
* @since 2.1
*/
-public class UpdateFileHeaderMojo extends AbstractLicenseWithDescriptorMojo {
+public class UpdateFileHeaderMojo extends AbstractLicenseWithDescriptorMojo implements FileHeaderProcessorConfiguration {
/**
* Name of project (or module).
@@ -150,24 +148,73 @@
*/
protected boolean clearAfterOperation;
+ /**
+ * @component role="org.nuiton.processor.Processor" roleHint="file-header"
+ * @since 2.1
+ */
+ protected FileHeaderProcessor processor;
+
+ /**
+ * @component role="org.nuiton.license.plugin.header.FileHeaderFilter" roleHint="update-file-header"
+ * @since 2.1
+ */
+ protected UpdateFileHeaderFilter filter;
+
+ /** internal file header transformer */
+ protected FileHeaderTransformer transformer;
+
+ /** internal default file header */
+ protected FileHeader header;
+
/** timestamp used for generation */
protected long timestamp;
- /** set of processed files */
- protected Set<File> processedFiles;
+ /**
+ * Defines state of a file after process.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+ enum FileState {
- /** set of updated files */
- protected Set<File> updatedFiles;
+ /** file was updated */
+ update,
- /** set of added header files */
- protected Set<File> addedFiles;
+ /** file was up to date */
+ uptodate,
- /** set of ignored files */
- protected Set<File> ignoreFiles;
+ /** something was added on file */
+ add,
- /** set of failed files */
- protected Set<File> failedFiles;
+ /** file was ignored */
+ ignore,
+ /** treatment failed for file */
+ fail;
+
+ /**
+ * register a file for this state on result dictionary.
+ *
+ * @param file file to add
+ * @param result dictionary to update
+ */
+ public void addFile(File file,
+ EnumMap<FileState, Set<File>> result) {
+ Set<File> fileSet = result.get(this);
+ if (fileSet == null) {
+ fileSet = new HashSet<File>();
+ result.put(this, fileSet);
+ }
+ fileSet.add(file);
+ }
+ }
+
+ /** set of processed files */
+ protected Set<File> processedFiles;
+
+ /** by file state files treated */
+ protected EnumMap<FileState, Set<File>> result;
+
@Override
public void init() throws Exception {
@@ -199,7 +246,7 @@
getLog().info(buffer.toString());
}
- if (updateCopyright) {
+ if (isUpdateCopyright()) {
getLog().warn("updateCopyright is not still available...");
//TODO-TC20100409 checks scm
@@ -212,268 +259,266 @@
// set timestamp used for temporary files
setTimestamp(System.nanoTime());
+ getFilter().setUpdateCopyright(isUpdateCopyright());
+ getFilter().setLog(getLog());
+ getProcessor().setConfiguration(this);
+ getProcessor().setFilter(filter);
+
super.init();
}
@Override
public void doAction() throws Exception {
- // create a file header processor which updates license content only
- FileHeaderProcessor processor = new FileHeaderProcessor() {
+ clear();
- @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>();
+ result = new EnumMap<FileState, Set<File>>(FileState.class);
try {
- processFiles(processor);
+ for (Header header : getLicenseProjectDescriptor().getHeaders()) {
+
+ processHeader(header);
+ }
+
} finally {
StringBuilder buffer = new StringBuilder();
- buffer.append("Operation result on ");
- buffer.append(getProcessedFiles().size());
- buffer.append(" file(s) :");
+ String format = "Operation result on %1$s file(s) :";
+ buffer.append(String.format(format, getProcessedFiles().size()));
- reportType(getFailedFiles(), "fail", buffer);
- reportType(getAddedFiles(), "add", buffer);
- reportType(getUpdatedFiles(), "update", buffer);
- reportType(getIgnoreFiles(), "ignore", buffer);
+ for (FileState state : FileState.values()) {
+ reportType(state, buffer);
+ }
+
getLog().info(buffer.toString());
+ // clean internal states
if (isClearAfterOperation()) {
clear();
}
}
}
- @Override
- protected void finalize() throws Throwable {
- super.finalize();
- clear();
- }
+ protected void processHeader(Header header) throws IOException {
- 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();
- }
- }
+ // obtain license from definition
+ String licenseName = header.getLicenseName();
+ License license = getLicense(licenseName);
- protected void processFiles(FileHeaderProcessor processor) throws IOException {
- for (LicenseSet licenseSet : getLicenseProject().getLicenseSets()) {
+ getLog().info("process header '" + header.getCommentStyle() + "'");
+ getLog().info("using " + license.getDescription());
- // obtain license from definition
- String licenseName = licenseSet.getLicenseName();
- License license = getLicense(licenseName);
+ // use header transformer according to comment style given in header
+ setTransformer(getTransformer(header.getCommentStyle()));
+ // 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
+ setHeader(defaultFileHeader);
+
+ // update processor filter
+ getProcessor().populateFilter();
+
+ for (FileSet fileSet : header.getFileSets()) {
+
+ File basedir = new File(getProject().getBasedir(),
+ fileSet.getBasedir());
if (isVerbose()) {
- getLog().info("process " + license.getDescription());
+ getLog().info("process file set with basedir : " + basedir);
}
- // file header to use if no header is found on a file
- FileHeader defaultFileHeader = buildDefaultFileHeader(
- license,
- getProjectName(),
- getInceptionYear(),
- getOrganizationName(),
- isAddSvnKeyWords(),
- getEncoding()
+ 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
);
- // change default license header in processor
- processor.setHeader(defaultFileHeader);
+ try {
+ for (Map.Entry<File, String[]> entry :
+ filestoTreate.entrySet()) {
- for (FileSet fileSet : licenseSet.getFileSets()) {
- File basedir = new File(getProject().getBasedir(),
- fileSet.getBasedir());
- if (isVerbose()) {
- getLog().info("process file set with basedir : " + basedir);
+ // treate all files of entry
+ processFileEntry(entry.getKey(), entry.getValue());
}
+ } finally {
+ filestoTreate.clear();
+ }
+ }
+ }
- List<String> includes = fileSet.getIncludes();
- if (includes.isEmpty()) {
+ protected void processFileEntry(File entryBasedir,
+ String[] paths) throws IOException {
- // it means include all
- includes.add("**/*");
- }
- List<String> excludes = fileSet.getExcludes();
+ getLog().info(paths.length + " file(s) to treate in " + entryBasedir);
+ for (String path : paths) {
+ File file = new File(entryBasedir, path);
+ if (getProcessedFiles().contains(file)) {
+ getLog().info("skip already processed file " + file);
+ continue;
+ }
- 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
+ // output file
+ File processFile =
+ new File(file.getAbsolutePath() + "_" + getTimestamp());
+ boolean doFinalize = false;
+ try {
+ doFinalize = processFile(file, processFile);
+ } catch (Exception e) {
+ getLog().warn("skip failed file : " +
+ e.getMessage() +
+ (e.getCause() == null ? "" :
+ " Cause : " + e.getCause().getMessage()), e
);
+ FileState.fail.addFile(file, getResult());
+ doFinalize = false;
+ } finally {
- // get header transformer according to file set
- FileHeaderTransformer transformer = getTransformer(fileSet.getHeaderType());
+ // always clean processor internal states
+ getProcessor().reset();
- // change transformer in processor
- processor.setTransformer(transformer);
+ // whatever was the result, this file is treated.
+ getProcessedFiles().add(file);
- // 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 (doFinalize) {
+ finalizeFile(file, processFile);
+ } else {
+ deleteFile(processFile);
}
-
- filestoTreate.clear();
}
}
}
- protected void updateFile(FileHeaderProcessor processor,
- File file) throws IOException {
+ /**
+ * Process the given {@code file} and save the result in the given
+ * {@code processFile}.
+ *
+ * @param file the file to process
+ * @param processFile the ouput processed file
+ * @return {@code true} if processFile can be finalize, otherwise need to be delete
+ * @throws IOException if any pb while treatment
+ */
+ protected boolean processFile(File file,
+ File processFile) 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);
}
+ String content;
+
try {
- try {
- processor.process(file, processFile);
- } catch (IllegalStateException e) {
+ // check before all that file should not be skip by the ignoreTag
+ // this is a costy operation
+ //TODO-TC-20100411 We should process always from the read content not reading again from file
- // could not obtain existing header
- getLog().warn(
- "skip file " + file +
- " Could not extract existing header!)");
- failedFiles.add(file);
- deleteFile(processFile);
- return;
- }
+ content = PluginHelper.readAsString(file, getEncoding());
- if (processor.isTouched()) {
+ } catch (IOException e) {
+ throw new IOException("Could not obtain content of file " + file);
+ }
- if (isVerbose()) {
- getLog().info("header was updated for " + file);
- }
- updatedFiles.add(file);
- finalizeFile(file, processFile);
- return;
- }
+ //check that file is not marked to be ignored
+ if (content.contains(getIgnoreTag())) {
+ getLog().info(
+ "ignore file (detected " + getIgnoreTag() + ") " + file);
- if (processor.isDetectHeader()) {
+ FileState.ignore.addFile(file, getResult());
- // 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;
+ return false;
+ }
+
+ FileHeaderProcessor processor = getProcessor();
+
+ // process file to detect header
+
+ try {
+ processor.process(file, processFile);
+ } catch (IllegalStateException e) {
+ // could not obtain existing header
+ throw new InvalideFileHeaderException(
+ "Could not extract header on file " + file, e);
+ } catch (Exception e) {
+ if (e instanceof InvalideFileHeaderException) {
+ throw (InvalideFileHeaderException) e;
}
+ throw new IOException("Could not process file " + file, e);
+ }
- // file has no header dealed by the plugin
- String content = PluginHelper.readAsString(file, getEncoding());
+ if (processor.isTouched()) {
- //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;
+ if (isVerbose()) {
+ getLog().info("header was updated for " + file);
}
+ if (processor.isModified()) {
- // no header and not marked to be ignored : add a new header
- getLog().info("adding license header on file " + file);
+ // header content has changed
+ // must copy back process file to file (if not dry run)
- //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());
+ FileState.update.addFile(file, getResult());
+ return true;
+
}
- addedFiles.add(file);
- finalizeFile(file, processFile);
+ FileState.uptodate.addFile(file, getResult());
+ return false;
+ }
- } catch (Exception e) {
- getLog().warn(
- "skip file " + file + " (could not process " +
- "for reason : " + e.getMessage() + ")", e);
- deleteFile(processFile);
- } finally {
+ // header was not fully (or not at all) detected in file
- // always clean processor internal states
- processor.reset();
+ if (processor.isDetectHeader()) {
+
+ // file has not a valid header (found a start process atg, but
+ // not an ending one), can not do anything
+ throw new InvalideFileHeaderException(
+ "Could not find header end on file " + file);
}
- }
- 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);
- }
- }
+ // no header at all, 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 = getTransformer().addHeader(
+ getFilter().getFullHeaderContent(),
+ content
+ );
+
+ if (!isDryRun()) {
+ writeFile(processFile, content, getEncoding());
}
+
+ FileState.add.addFile(file, getResult());
+ return true;
}
protected void finalizeFile(File file, File processFile) throws IOException {
@@ -505,6 +550,52 @@
}
}
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ clear();
+ }
+
+ protected void clear() {
+ Set<File> files = getProcessedFiles();
+ if (files != null) {
+ files.clear();
+ }
+ EnumMap<FileState, Set<File>> result = getResult();
+ if (result != null) {
+ for (Set<File> fileSet : result.values()) {
+ fileSet.clear();
+ }
+ result.clear();
+ }
+ }
+
+ protected void reportType(FileState state, StringBuilder buffer) {
+ String operation = state.name();
+
+ Set<File> set = getFiles(state);
+ if (set == null || set.isEmpty()) {
+ if (isVerbose()) {
+ buffer.append("\n * no header to ");
+ buffer.append(operation);
+ buffer.append(".");
+ }
+ return;
+ }
+ 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);
+ }
+ }
+ }
+
public boolean isClearAfterOperation() {
return clearAfterOperation;
}
@@ -537,38 +628,48 @@
return dryRun;
}
+ public UpdateFileHeaderFilter getFilter() {
+ return filter;
+ }
+
@Override
- public boolean isSkip() {
- return skipUpdateLicense;
+ public FileHeader getFileHeader() {
+ return header;
}
@Override
- public void setSkip(boolean skipUpdateLicense) {
- this.skipUpdateLicense = skipUpdateLicense;
+ public FileHeaderTransformer getTransformer() {
+ return transformer;
}
+ @Override
+ public boolean isSkip() {
+ return skipUpdateLicense;
+ }
+
public Set<File> getProcessedFiles() {
return processedFiles;
}
- public Set<File> getUpdatedFiles() {
- return updatedFiles;
+ public EnumMap<FileState, Set<File>> getResult() {
+ return result;
}
- public Set<File> getAddedFiles() {
- return addedFiles;
+ public Set<File> getFiles(FileState state) {
+ return result.get(state);
}
- public Set<File> getIgnoreFiles() {
- return ignoreFiles;
+ public boolean isAddSvnKeyWords() {
+ return addSvnKeyWords;
}
- public Set<File> getFailedFiles() {
- return failedFiles;
+ public FileHeaderProcessor getProcessor() {
+ return processor;
}
- public boolean isAddSvnKeyWords() {
- return addSvnKeyWords;
+ @Override
+ public void setSkip(boolean skipUpdateLicense) {
+ this.skipUpdateLicense = skipUpdateLicense;
}
public void setDryRun(boolean dryRun) {
@@ -611,91 +712,21 @@
this.clearAfterOperation = clearAfterOperation;
}
- public void setProcessedFiles(Set<File> processedFiles) {
- this.processedFiles = processedFiles;
+ public void setTransformer(FileHeaderTransformer transformer) {
+ this.transformer = transformer;
}
- public void setUpdatedFiles(Set<File> updatedFiles) {
- this.updatedFiles = updatedFiles;
+ public void setHeader(FileHeader header) {
+ this.header = header;
}
- public void setAddedFiles(Set<File> addedFiles) {
- this.addedFiles = addedFiles;
+ public void setProcessor(FileHeaderProcessor processor) {
+ this.processor = processor;
}
- public void setIgnoreFiles(Set<File> ignoreFiles) {
- this.ignoreFiles = ignoreFiles;
+ public void setFilter(UpdateFileHeaderFilter filter) {
+ this.filter = filter;
}
- 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;
- }
- }
}
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 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -28,47 +28,78 @@
package org.nuiton.license.plugin.header;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.maven.plugin.logging.Log;
import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer;
import org.nuiton.processor.filters.DefaultFilter;
/**
- * TODO
+ * File Header filter.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
public abstract class FileHeaderFilter extends DefaultFilter {
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private final Log log = LogFactory.getLog(FileHeaderFilter.class);
-
- /** flag pour indiquer si la licence a ete trouvee entre le header et le footer */
+ /**
+ * flag set to {@code true} when a header was detected (says detects both
+ * start and end process tags).
+ */
protected boolean touched;
- /** flag pour indiquer si on a rencontree le header du filtre */
+ /** flag set to {@code true} when a header was detected and was modified. */
+ protected boolean modified;
+
+ /** flag set to {@code true} as soon as start process tag was detected. */
protected boolean detectHeader;
- protected FileHeader header;
+ /** incoming default file header model */
+ protected FileHeader fileHeader;
+ /** header transformer */
protected FileHeaderTransformer transformer;
- protected abstract String treateHeader(FileHeader header, FileHeaderTransformer transformer, String ch);
+ /** cached header content */
+ protected String headerContent;
- public FileHeaderFilter(FileHeader header, FileHeaderTransformer transformer) {
- this.header = header;
- this.transformer = transformer;
+ /** cached full header content (with process tag + comment box) */
+ protected String processTagHeaderContent;
+
+ /** cached full header content (with process tag + comment box) */
+ protected String fullHeaderContent;
+
+ /** maven logger */
+ protected Log log;
+
+ /**
+ * The logic to implements when a header was touched.
+ *
+ * @param ch the actual header content
+ * @return the new header content (beginning by a
+ * {@link FileHeaderTransformer#getProcessStartTag()} and ending
+ * with a {@link FileHeaderTransformer#getProcessEndTag()}).
+ */
+ protected abstract String treateHeader(String ch);
+
+ public FileHeaderFilter() {
}
+ public Log getLog() {
+ return log;
+ }
+
+ public void setLog(Log log) {
+ this.log = log;
+ }
+
@Override
protected String performInFilter(String ch) {
if (log.isDebugEnabled()) {
log.debug(ch);
}
- if (touched) {
- // on autorise pas deux process de la licence dans un fichier java
- throw new IllegalStateException("Can only have one file header start tag : " + getHeader());
+ if (isTouched()) {
+ // Can NOT authorize two header in a same source
+ throw new IllegalStateException(
+ "Can only have one file header start tag : " + getHeader());
}
if (getMatchIndexFor(ch, getHeader()) == NOT_FOUND) {
@@ -76,12 +107,17 @@
touched = true;
// update header
- String newHeader = treateHeader(header, transformer, ch);
+ String newHeader = treateHeader(ch);
+ if (!ch.equals(newHeader)) {
+
+ // header content was modified, mark it
+ modified = true;
+ }
return newHeader;
}
- // ce cas arrive lorsque l'on a parcouru tout le fichier avec detection
- // de la balise header mais sans balise footer
- // et on arrive dans cette methode dans le flush du filter
+ // Means we detects the process start tag but not the end one.
+ // coming then here from the flush filter method... So changes nothing
+ // just return the text as it comes.
return ch;
}
@@ -95,12 +131,12 @@
@Override
protected String getHeader() {
- return transformer.getProcessStartTag();
+ return getTransformer().getProcessStartTag();
}
@Override
protected String getFooter() {
- return transformer.getProcessEndTag();
+ return getTransformer().getProcessEndTag();
}
@Override
@@ -112,17 +148,74 @@
}
}
+ public String getHeaderContent() {
+ if (headerContent == null) {
+ headerContent = getTransformer().toString(getFileHeader());
+ }
+ return headerContent;
+ }
+
+ public String getProcessTagHeaderContent() {
+ if (processTagHeaderContent == null) {
+
+ // box with process tag
+ processTagHeaderContent =
+ getTransformer().boxProcessTag(getHeaderContent());
+
+ }
+ return processTagHeaderContent;
+ }
+
+ public String getFullHeaderContent() {
+ if (fullHeaderContent == null) {
+
+ // box with comment
+ fullHeaderContent = getTransformer().boxComment(
+ getProcessTagHeaderContent(),
+ true
+ );
+ }
+ return fullHeaderContent;
+ }
+
public boolean isTouched() {
return touched;
}
+ public boolean isModified() {
+ return modified;
+ }
+
public boolean isDetectHeader() {
return detectHeader;
}
+ public FileHeader getFileHeader() {
+ return fileHeader;
+ }
+
+ public FileHeaderTransformer getTransformer() {
+ return transformer;
+ }
+
+ public void setFileHeader(FileHeader fileHeader) {
+ this.fileHeader = fileHeader;
+ }
+
+ public void setTransformer(FileHeaderTransformer transformer) {
+ this.transformer = transformer;
+ }
+
public void reset() {
touched = false;
+ modified = false;
detectHeader = false;
state = State.SEARCH_HEADER;
}
+
+ public void resetContent() {
+ headerContent = null;
+ processTagHeaderContent = null;
+ fullHeaderContent = null;
+ }
}
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 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -37,62 +37,62 @@
import java.io.IOException;
/**
- * TODO
+ * File header processor.
*
* @author tchemit <chemit(a)codelutin.com>
+ * @plexus.component role="org.nuiton.processor.Processor" role-hint="file-header"
* @since 2.1
*/
-public abstract class FileHeaderProcessor extends Processor {
+public class FileHeaderProcessor extends Processor {
- /** file header */
- protected FileHeader header;
+ /** processor configuration */
+ protected FileHeaderProcessorConfiguration configuration;
- protected FileHeaderTransformer transformer;
-
- /** internal filter */
+ /** internal file header filter */
protected FileHeaderFilter filter;
- /** cached header content */
- protected String headerContent;
+ public FileHeaderProcessor() {
+ }
- /** cached full header content (with process tag + comment box) */
- protected String processTagHeaderContent;
+ public FileHeaderProcessorConfiguration getConfiguration() {
+ return configuration;
+ }
- /** cached full header content (with process tag + comment box) */
- protected String fullHeaderContent;
-
- public abstract FileHeaderFilter newFilter(FileHeader header, FileHeaderTransformer transformer);
-
- public FileHeaderProcessor() {
+ public FileHeaderFilter getFilter() {
+ return filter;
}
/**
- * @return {@code true} if processed file was modified (says the header was
- * fully found and updating), {@code false} otherwise
+ * @return {@code true} if processed file was touched (says the header was
+ * fully found), {@code false} otherwise
* @see FileHeaderFilter#isTouched()
*/
public boolean isTouched() {
- return filter != null && filter.isTouched();
+ return getFilter() != null && getFilter().isTouched();
}
/**
+ * @return {@code true} if processed file was modified (says the header was
+ * fully found and content changed), {@code false} otherwise
+ * @see FileHeaderFilter#isModified()
+ */
+ public boolean isModified() {
+ return getFilter() != null && getFilter().isModified();
+ }
+
+ /**
* @return {@code true} if header of header was detected
* @see FileHeaderFilter#isDetectHeader()
*/
public boolean isDetectHeader() {
- return filter != null && filter.isDetectHeader();
+ return getFilter() != null && getFilter().isDetectHeader();
}
public void process(File filein, File fileout) throws IOException, IllegalStateException {
- if (header == null) {
- throw new IllegalStateException("no file header sets.");
- }
- if (transformer == null) {
- throw new IllegalStateException("no file header transformer sets.");
- }
- if (filter == null) {
- setFilter(newFilter(header, transformer));
- }
+
+ checkInit();
+ reset();
+
FileReader input = new FileReader(filein);
try {
FileWriter output = new FileWriter(fileout);
@@ -106,69 +106,69 @@
}
}
- public String getHeaderContent() {
- if (headerContent == null) {
- headerContent = transformer.toString(header);
- }
- return headerContent;
- }
+ public void populateFilter() {
+ FileHeader fileHeader = getConfiguration().getFileHeader();
+ boolean change = false;
- public String getProcessTagHeaderContent() {
- if (processTagHeaderContent == null) {
+ FileHeaderFilter filter = getFilter();
- // box with process tag
- processTagHeaderContent =
- transformer.boxProcessTag(getHeaderContent());
+ if (!fileHeader.equals(filter.getFileHeader())) {
+ // change file header
+
+ filter.setFileHeader(fileHeader);
+ change = true;
}
- return processTagHeaderContent;
- }
+ FileHeaderTransformer transformer = getConfiguration().getTransformer();
+ if (!transformer.equals(filter.getTransformer())) {
- public String getFullHeaderContent() {
- if (fullHeaderContent == null) {
+ // change file transformer
- // box with comment
- fullHeaderContent =
- transformer.boxComment(getProcessTagHeaderContent(), true);
+ filter.setTransformer(transformer);
+ change = true;
}
- return fullHeaderContent;
- }
+ if (change) {
-// public FileHeader getHeader() {
-// return header;
-// }
-//
-// public FileHeaderTransformer getTransformer() {
-// return transformer;
-// }
-
- public void setHeader(FileHeader header) {
- this.header = header;
- reset();
+ // something has changed, must reset content cache
+ filter.resetContent();
+ }
}
- public void setTransformer(FileHeaderTransformer transformer) {
- this.transformer = transformer;
- reset();
+ public void setConfiguration(FileHeaderProcessorConfiguration configuration) {
+ this.configuration = configuration;
}
-//
-// protected FileHeaderFilter getFilter() {
-// return filter;
-// }
public void setFilter(FileHeaderFilter filter) {
this.filter = filter;
setInputFilter(filter);
}
-
public void reset() {
if (filter != null) {
filter.reset();
- filter = null;
}
- headerContent = null;
- processTagHeaderContent = null;
- fullHeaderContent = null;
}
+
+ protected FileHeader getFileHeader() {
+ return getConfiguration().getFileHeader();
+ }
+
+ protected FileHeaderTransformer getTransformer() {
+ return getConfiguration().getTransformer();
+ }
+
+ protected void checkInit() throws IllegalStateException {
+ if (getConfiguration() == null) {
+ throw new IllegalStateException("no configuration set.");
+ }
+ if (getFileHeader() == null) {
+ throw new IllegalStateException("no file header set.");
+ }
+ if (getTransformer() == null) {
+ throw new IllegalStateException("no file header transformer set.");
+ }
+ if (getFilter() == null) {
+ throw new IllegalStateException("no file header filter set.");
+ }
+ }
}
Added: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessorConfiguration.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessorConfiguration.java (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessorConfiguration.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,51 @@
+/*
+ * #%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.maven.plugin.logging.Log;
+import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer;
+
+/**
+ * Contract of required configuration of the {@link FileHeaderProcessor}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+public interface FileHeaderProcessorConfiguration {
+
+ /** @return mojo logger */
+ Log getLog();
+
+ /** @return the current file header to use */
+ FileHeader getFileHeader();
+
+ /** @return the current file transformer to use */
+ FileHeaderTransformer getTransformer();
+
+}
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessorConfiguration.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/main/java/org/nuiton/license/plugin/header/InvalideFileHeaderException.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/InvalideFileHeaderException.java (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/InvalideFileHeaderException.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,57 @@
+/*
+ * #%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 java.io.IOException;
+
+/**
+ * Exception to be thrown when a file header could not be read or transformed
+ * back to a {@link FileHeader}
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+public class InvalideFileHeaderException extends IOException {
+ private static final long serialVersionUID = 1L;
+
+ public InvalideFileHeaderException() {
+ }
+
+ public InvalideFileHeaderException(String message) {
+ super(message);
+ }
+
+ public InvalideFileHeaderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalideFileHeaderException(Throwable cause) {
+ super(cause);
+ }
+}
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/header/InvalideFileHeaderException.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/main/java/org/nuiton/license/plugin/header/UpdateFileHeaderFilter.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/UpdateFileHeaderFilter.java (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/UpdateFileHeaderFilter.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,109 @@
+/*
+ * #%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;
+
+/**
+ * Implementation of {@link FileHeaderFilter} to update an incoming header.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @plexus.component role="org.nuiton.license.plugin.header.FileHeaderFilter" role-hint="update-file-header"
+ * @since 2.1
+ */
+public class UpdateFileHeaderFilter extends FileHeaderFilter {
+
+ protected boolean updateCopyright;
+
+ public UpdateFileHeaderFilter() {
+ }
+
+ @Override
+ protected String treateHeader(String ch) {
+
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("header\n" + ch);
+ }
+
+ FileHeaderTransformer transformer = getTransformer();
+
+ // 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(getFileHeader().getLicense());
+
+ if (isUpdateCopyright()) {
+ // 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;
+ }
+
+ public boolean isUpdateCopyright() {
+ return updateCopyright;
+ }
+
+ public void setUpdateCopyright(boolean updateCopyright) {
+ this.updateCopyright = updateCopyright;
+ }
+}
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/header/UpdateFileHeaderFilter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/main/java/org/nuiton/license/plugin/header/generator/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/generator/package.html (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/package.html 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,11 @@
+<html>
+<body>
+<h1>Header generator package</h1>
+
+<p>
+ This package contains the old and <b>deprecated</b> api (since 2.1) of the
+ file header generator.
+</p>
+
+</body>
+</html>
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/header/generator/package.html
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/main/java/org/nuiton/license/plugin/header/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/package.html (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/package.html 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,13 @@
+<html>
+<body>
+<h1>Header package</h1>
+
+<p>
+ This package contains the api of the file header.
+</p>
+
+<p>
+ <b>Note:</b> The generator package is deprecated since 2.1.
+</p>
+</body>
+</html>
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/header/package.html
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
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 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -181,6 +181,11 @@
}
@Override
+ public String addHeader(String header, String content) {
+ return header + content;
+ }
+
+ @Override
public void setCommentLinePrefix(String commentLinePrefix) {
this.commentLinePrefix = commentLinePrefix;
}
@@ -222,7 +227,10 @@
}
@Override
- public String toString(FileHeader model) {
+ public String toString(FileHeader model) throws NullPointerException {
+ if (model == null) {
+ throw new NullPointerException("model can not be null!");
+ }
StringBuilder buffer = new StringBuilder();
String sectionDelimiter = LINE_SEPARATOR + getSectionDelimiter() +
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 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -115,6 +115,15 @@
String getCommentLinePrefix();
/**
+ * Adds the header.
+ *
+ * @param header header to add
+ * @param content content of original file
+ * @return the new full file content beginning with header
+ */
+ String addHeader(String header, String content);
+
+ /**
* Box the given {@code header} in a comment.
*
* @param header the header content WITHOUT any comment boxing
@@ -165,8 +174,9 @@
*
* @param model the model of the file header
* @return the UNBOXED header content
+ * @throws NullPointerException if model is null
*/
- String toString(FileHeader model);
+ String toString(FileHeader model) throws NullPointerException;
/**
* Changes the name of the transformer.
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 20:50:02 UTC (rev 1736)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -39,7 +39,8 @@
public static final String NAME = "xml";
- public static final String DESCRIPTION = "header transformer with xml comment style";
+ public static final String DESCRIPTION =
+ "header transformer with xml comment style";
public static final String COMMENT_LINE_PREFIX = " ";
@@ -55,4 +56,36 @@
COMMENT_LINE_PREFIX
);
}
-}
+
+ @Override
+ public String addHeader(String header, String content) {
+
+ String result;
+
+ String prolog = null;
+ int startProlog = content.indexOf("<?xml");
+ if (startProlog > -1) {
+
+ // prolog start was detected
+ int endProlog = content.indexOf("?>", startProlog);
+
+ if (endProlog > -1) {
+
+ // prolog end was detected
+ prolog = content.substring(0, endProlog + 2);
+ }
+ }
+
+ if (prolog == null) {
+
+ // no prolog detected
+ result = super.addHeader(header, content);
+ } else {
+
+ // prolog detected
+ content = content.substring(prolog.length());
+ result = super.addHeader(prolog + '\n'+ header, content);
+ }
+ return result;
+ }
+}
\ No newline at end of file
Added: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/package.html (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/package.html 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,10 @@
+<html>
+<body>
+<h1>Header transformer package</h1>
+
+<p>
+ This package contains the api of the file header transformer.
+</p>
+
+</body>
+</html>
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/package.html
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/main/java/org/nuiton/license/plugin/model/descriptor/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/descriptor/package.html (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/descriptor/package.html 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,6 @@
+<html>
+<body>
+<h1>Descriptor Model package</h1>
+This package contains the api of the license project descriptor.
+</body>
+</html>
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/model/descriptor/package.html
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/main/java/org/nuiton/license/plugin/model/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/package.html (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/package.html 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,10 @@
+<html>
+<body>
+<h1>Model package</h1>
+This package contains all models of the project.
+<ul>
+ <li>LicenceProjectDescriptor api (generated by modello)</li>
+ <li>License api </li>
+</ul>
+</body>
+</html>
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/model/package.html
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/main/java/org/nuiton/license/plugin/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/package.html (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/package.html 2010-04-12 11:01:09 UTC (rev 1737)
@@ -0,0 +1,6 @@
+<html>
+<body>
+<h1>Maven license plugin</h1>
+Base package of the plugin containing all mojos.
+</body>
+</html>
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/package.html
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/main/mdo/descriptor.mdo
===================================================================
--- trunk/src/main/mdo/descriptor.mdo 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/mdo/descriptor.mdo 2010-04-12 11:01:09 UTC (rev 1737)
@@ -28,38 +28,41 @@
<model xsd.namespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
xsd.targetNamespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0">
- <id>licenseProject</id>
- <name>LicenseProject</name>
+ <id>licenseProjectDescriptor</id>
+ <name>LicenseProjectDescriptor</name>
<description>
<![CDATA[
<p>
Maven License Plugin relies on the provided project descriptors to dictate
- its execution. Although there are already prefabricated descriptors available
+ its execution.
+ </p>
+ <p>
+ TODO : Although there are already prefabricated descriptors available
for use, they can only suffice some of the common license requirements.
</p>
<p>
So in order for you to customize the way the License Plugin updates your
licenses, you need to know how to use the License project Descriptor.
</p>
- <p>
- This descriptor specifies the type of licenses to apply for some defined
- filesets.
- </p>
]]>
</description>
<defaults>
<default>
<key>package</key>
- <value>org.nuiton.license.plugin.model.project</value>
+ <value>org.nuiton.license.plugin.model.descriptor</value>
</default>
</defaults>
<classes>
<class rootElement="true" xml.tagName="project">
- <name>LicenseProject</name>
+ <name>LicenseProjectDescriptor</name>
<description>
<![CDATA[
- An license project defines a collection of files to be reacted by the
- plugin (says update header).
+ The license project descriptor describe licenses used in a project.
+ <p/>
+ <ul>
+ <li>mainLicense of the project</li>
+ <li>headers to update (or add) on sources of the project</li>
+ </ul>
]]>
</description>
<version>1.0.0+</version>
@@ -77,27 +80,45 @@
</description>
</field>
<field>
- <name>licenseSets</name>
+ <name>headers</name>
<version>1.0.0+</version>
<association>
- <type>LicenseSet</type>
+ <type>Header</type>
<multiplicity>*</multiplicity>
</association>
<description>
<![CDATA[
- Specifies licenses to apply on a project. A licenseSet is specified
- by providing one or more of <licenseSet> subelements.
+ Collection of header.
+
+ {@link Header}
]]>
</description>
</field>
+ <field>
+ <name>header</name>
+ <version>1.0.0+</version>
+ <association>
+ <type>Header</type>
+ <multiplicity>1</multiplicity>
+ </association>
+ <description>
+ <![CDATA[
+ To add a single header.
+
+ {@link Header}
+ ]]>
+ </description>
+ </field>
</fields>
</class>
<class>
- <name>LicenseSet</name>
+ <name>Header</name>
<description>
<![CDATA[
- A licenseSet represents one license to apply to one or more filesets.
+ A Header represents a set of resources using the same {@code header type}.
+ <p/>
+ The licenseName can be inherited by the mainLicense of the project.
]]>
</description>
<version>1.0.0+</version>
@@ -115,6 +136,17 @@
</description>
</field>
<field>
+ <name>commentStyle</name>
+ <version>1.0.0+</version>
+ <type>String</type>
+ <required>true</required>
+ <description>
+ <![CDATA[
+ The style of the comment which box the header to generate (or updates).
+ ]]>
+ </description>
+ </field>
+ <field>
<name>fileSets</name>
<version>1.0.0+</version>
<association>
@@ -128,6 +160,20 @@
]]>
</description>
</field>
+ <field>
+ <name>fileSet</name>
+ <version>1.0.0+</version>
+ <association>
+ <type>FileSet</type>
+ <multiplicity>1</multiplicity>
+ </association>
+ <description>
+ <![CDATA[
+ Specifies a single file sets to include in the license set. A fileSet is
+ specified by providing one or more of <licenseSet> subelements.
+ ]]>
+ </description>
+ </field>
</fields>
</class>
@@ -142,14 +188,6 @@
</description>
<fields>
<field>
- <name>headerType</name>
- <version>1.0.0+</version>
- <type>String</type>
- <required>true</required>
- <description>The type of header to generate (or updates).
- </description>
- </field>
- <field>
<name>useDefaultExcludes</name>
<version>1.0.0+</version>
<type>boolean</type>
@@ -188,6 +226,24 @@
</description>
</field>
<field>
+ <name>include</name>
+ <version>1.0.0+</version>
+ <type>String</type>
+ <!--<association>-->
+ <!--<multiplicity>1</multiplicity>-->
+ <!--</association>-->
+ <description>
+ <![CDATA[
+ <p>
+ To add a single include.
+ </p>
+ When <include> subelements are present, they define a set of
+ files and directory to include. If none is present, then
+ <includes> represents all valid values.
+ ]]>
+ </description>
+ </field>
+ <field>
<name>excludes</name>
<version>1.0.0+</version>
<association>
@@ -203,6 +259,24 @@
</description>
</field>
<field>
+ <name>exclude</name>
+ <version>1.0.0+</version>
+ <type>String</type>
+ <!--<association>-->
+ <!--<multiplicity>1</multiplicity>-->
+ <!--</association>-->
+ <description>
+ <![CDATA[
+ <p>
+ To add a single exclude.
+ </p>
+ When <exclude> subelements are present, they define a set of
+ files and directory to exclude. If none is present, then
+ <excludes> represents no exclusions.
+ ]]>
+ </description>
+ </field>
+ <field>
<name>lineEnding</name>
<version>1.0.0+</version>
<type>String</type>
Modified: trunk/src/main/resources/META-INF/licenses/gpl_v1/header.txt
===================================================================
--- trunk/src/main/resources/META-INF/licenses/gpl_v1/header.txt 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/resources/META-INF/licenses/gpl_v1/header.txt 2010-04-12 11:01:09 UTC (rev 1737)
@@ -6,7 +6,7 @@
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.
+GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program. If not, see
Modified: trunk/src/main/resources/META-INF/licenses/gpl_v2/header.txt
===================================================================
--- trunk/src/main/resources/META-INF/licenses/gpl_v2/header.txt 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/resources/META-INF/licenses/gpl_v2/header.txt 2010-04-12 11:01:09 UTC (rev 1737)
@@ -6,7 +6,7 @@
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.
+GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program. If not, see
Modified: trunk/src/main/resources/META-INF/licenses/gpl_v3/header.txt
===================================================================
--- trunk/src/main/resources/META-INF/licenses/gpl_v3/header.txt 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/resources/META-INF/licenses/gpl_v3/header.txt 2010-04-12 11:01:09 UTC (rev 1737)
@@ -6,7 +6,7 @@
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.
+GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program. If not, see
Modified: trunk/src/main/resources/META-INF/licenses/licenses.properties
===================================================================
--- trunk/src/main/resources/META-INF/licenses/licenses.properties 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/main/resources/META-INF/licenses/licenses.properties 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,10 +1,10 @@
-agpl_v3=GNU Affero General Public License version 3.0
-apache_v2=License Apache version 3.0
+agpl_v3=GNU Affero General Public License (AGPL) version 3.0
+apache_v2=Apache License version 2.0
cddl_v1=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-fdl_v1_3=Free Documentation License Version 1.3
-gpl_v1=License gpl version 1.0
-gpl_v2=License gpl version 2.0
-gpl_v3=License gpl version 3.0
-lgpl_v2_1=License lgpl version 2.1
-lgpl_v3=License lgpl version 3.0
+fdl_v1_3=GNU Free Documentation License (FDL) version 1.3
+gpl_v1=GNU General Public License (GPL) version 1.0
+gpl_v2=GNU General Public License (GPL) version 2.0
+gpl_v3=GNU General Public License (GPL) version 3.0
+lgpl_v2_1=GNU General Lesser Public License (LGPL) version 2.1
+lgpl_v3=GNU General Lesser Public License (LGPL) version 3.0
mit=MIT-License
Modified: trunk/src/site/rst/descriptor.rst
===================================================================
--- trunk/src/site/rst/descriptor.rst 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/site/rst/descriptor.rst 2010-04-12 11:01:09 UTC (rev 1737)
@@ -13,7 +13,7 @@
.. -
.. * #%L
.. * Maven License Plugin
-.. *
+.. * .. *
.. * $Author$
.. * $LastChangedDate$
.. * $LastChangedRevision$
@@ -23,16 +23,16 @@
.. * Copyright (C) 2008 - 2010 CodeLutin
.. * %%
.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
.. * License, or (at your option) any later version.
-.. *
+.. *
.. * This program is distributed in the hope that it will be useful,
.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
.. * License along with this program. If not, see
.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
.. * #L%
@@ -65,21 +65,22 @@
<?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">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
+ <headers>
+ <header>
+ <licenseName>lgpl_v3</licenseName>
+ <commentStyle>java</commentStyle>
<fileSets>
<fileSet>
- <headerType>java</headerType>
- <basedir>src/main/java</basedir>
+ <basedir>all/src</basedir>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
</fileSets>
- </licenseSet>
- </licenseSets>
+ </header>
+ </headers>
</project>
.. _update-file-header: update-file-header-mojo.html
@@ -88,4 +89,4 @@
.. _comment-style-list: comment-style-list-mojo.html
-.. _xsd file: licenseProject-1.0.0.xsd
+.. _xsd file: licenseProjectDescriptor-1.0.0.xsd
Modified: trunk/src/site/rst/header.rst
===================================================================
--- trunk/src/site/rst/header.rst 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/site/rst/header.rst 2010-04-12 11:01:09 UTC (rev 1737)
@@ -13,7 +13,7 @@
.. -
.. * #%L
.. * Maven License Plugin
-.. *
+.. * .. *
.. * $Author$
.. * $LastChangedDate$
.. * $LastChangedRevision$
@@ -23,16 +23,16 @@
.. * Copyright (C) 2008 - 2010 CodeLutin
.. * %%
.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
.. * License, or (at your option) any later version.
-.. *
+.. *
.. * This program is distributed in the hope that it will be useful,
.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
.. * License along with this program. If not, see
.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
.. * #L%
@@ -55,21 +55,21 @@
::
- (1) #\%\L
+ (1) # % L
(2) Project description
- (3) --
+ (3) %%
(4) Copyright (C) 2010 your organization
- (5) --
+ (5) %%
(6) License content
- (7) \#\L\%
+ (7) # L %
- * (1) the start process tag used to detect begin of header (NEVER suppress it).
- * (2) Project description section
- * (3) Header section delimiter
- * (4) Copyright section of the file (see next section for detail)
- * (5) Header section delimiter
- * (6) License section
- * (7) the end process tag used to detect end of header (NEVER suppress it).
+* (1) the start process tag used to detect begin of header (NEVER suppress it).
+* (2) Project description section
+* (3) Header section delimiter
+* (4) Copyright section of the file (see next section for detail)
+* (5) Header section delimiter
+* (6) License section
+* (7) the end process tag used to detect end of header (NEVER suppress it).
Configuration
-------------
@@ -86,6 +86,7 @@
Copyright section must exactly be of this form :
::
+
Copyright (C) firstYear[ - lastYear] holder
If *firstYear* and *lastYear* are the same then lastYear is omitted.
@@ -107,6 +108,7 @@
----------
::
+
/*
* HEADER
*/
@@ -115,6 +117,7 @@
---------
::
+
<!--
HEADER
-->
@@ -123,6 +126,7 @@
----------------
::
+
######
# HEADER
######
@@ -131,6 +135,7 @@
---------
::
+
~~~~~~
~~ HEADER
~~~~~~
@@ -139,10 +144,11 @@
---------
::
- ..
- .. HEADER
- ..
+ .. -
+ .. * HEADER
+ .. -
+
Ignore a header
===============
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/site/rst/index.rst 2010-04-12 11:01:09 UTC (rev 1737)
@@ -13,7 +13,7 @@
.. -
.. * #%L
.. * Maven License Plugin
-.. *
+.. * .. *
.. * $Author$
.. * $LastChangedDate$
.. * $LastChangedRevision$
@@ -23,16 +23,16 @@
.. * Copyright (C) 2008 - 2010 CodeLutin
.. * %%
.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
.. * License, or (at your option) any later version.
-.. *
+.. *
.. * This program is distributed in the hope that it will be useful,
.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
.. * License along with this program. If not, see
.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
.. * #L%
@@ -71,9 +71,9 @@
/*
* # % L
* Plugin maven de changement de license
- * --
+ * %%
* Copyright (C) 2008 - 2009 CodeLutin
- * --
+ * %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
Modified: trunk/src/site/rst/usage.rst
===================================================================
--- trunk/src/site/rst/usage.rst 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/site/rst/usage.rst 2010-04-12 11:01:09 UTC (rev 1737)
@@ -12,7 +12,7 @@
.. -
.. * #%L
.. * Maven License Plugin
-.. *
+.. * .. *
.. * $Author$
.. * $LastChangedDate$
.. * $LastChangedRevision$
@@ -22,16 +22,16 @@
.. * Copyright (C) 2008 - 2010 CodeLutin
.. * %%
.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
.. * License, or (at your option) any later version.
-.. *
+.. *
.. * This program is distributed in the hope that it will be useful,
.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
.. * License along with this program. If not, see
.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
.. * #L%
@@ -88,6 +88,24 @@
for full detail see `license-list`_ detail page.
+Example of execution
+++++++++++++++++++++
+
+::
+ [INFO] [license:license-list {execution: default-cli}]
+ [INFO] Available licenses :
+
+ * agpl_v3 : GNU Affero General Public License (AGPL) version 3.0
+ * apache_v2 : Apache License version 2.0
+ * cddl_v1 : COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+ * fdl_v1_3 : GNU Free Documentation License (FDL) version 1.3
+ * gpl_v1 : GNU General Public License (GPL) version 1.0
+ * gpl_v2 : GNU General Public License (GPL) version 2.0
+ * gpl_v3 : GNU General Public License (GPL) version 3.0
+ * lgpl_v2_1 : GNU General Lesser Public License (LGPL) version 2.1
+ * lgpl_v3 : GNU General Lesser Public License (LGPL) version 3.0
+ * mit : MIT-License
+
comment-style-list goal
_______________________
@@ -107,6 +125,19 @@
for full detail see `comment-style-list`_ detail page.
+Example of execution
+++++++++++++++++++++
+
+::
+ [INFO] [license:comment-style-list {execution: default-cli}]
+ [INFO] List of available comment styles:
+
+ - apt : header transformer with apt comment style
+ - java : header transformer with java comment style
+ - properties : header transformer with properties file comment style
+ - rst : header transformer with rst comment style
+ - xml : header transformer with xml comment style
+
help goal
_________
Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java 2010-04-12 11:01:09 UTC (rev 1737)
@@ -34,7 +34,10 @@
import org.nuiton.plugin.PluginHelper;
import java.io.File;
+import java.util.Set;
+import static org.nuiton.license.plugin.UpdateFileHeaderMojo.FileState;
+
/**
* Tests the {@link UpdateFileHeaderMojo}.
*
@@ -43,6 +46,19 @@
*/
public class UpdateFileHeaderMojoTest extends AbstractMojoTest<UpdateFileHeaderMojo> {
+
+ private Set<File> uptodates;
+
+ private Set<File> updates;
+
+ private Set<File> adds;
+
+ private Set<File> fails;
+
+ private Set<File> ignores;
+
+ private Set<File> process;
+
@Override
protected String getGoalName(String methodName) {
return "update-file-header";
@@ -68,10 +84,15 @@
// 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());
+ execute(true, mojo);
+ Assert.assertEquals(1, process.size());
+ if (updates == null) {
+ Assert.assertEquals(1, adds.size());
+ } else {
+ Assert.assertEquals(1, updates.size());
+ Assert.assertNull(adds);
+ }
content = PluginHelper.readAsString(f, mojo.getEncoding());
// check header
@@ -79,11 +100,10 @@
checkPattern(f, content, "Project name : maven-license-plugin-java", true);
checkPattern(f, content, "Organization is CodeLutin", true);
- mojo.setVerbose(false);
- mojo.execute();
+ execute(false, mojo);
- Assert.assertEquals(1, mojo.getProcessedFiles().size());
- Assert.assertEquals(1, mojo.getUpdatedFiles().size());
+ Assert.assertEquals(1, process.size());
+ Assert.assertEquals(1, updates.size());
int oldLength = content.length();
content = PluginHelper.readAsString(f, mojo.getEncoding());
@@ -92,44 +112,51 @@
Assert.assertEquals(oldLength, newLength);
}
+// @Ignore
+
@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());
+ execute(true, mojo);
+ Assert.assertEquals(4, process.size());
+
+ if (updates.size() < 2) {
+ // first invocation
+ Assert.assertEquals(1, updates.size());
+ Assert.assertEquals(1, adds.size());
+ Assert.assertNull(uptodates);
} else {
- Assert.assertEquals(1, mojo.getUpdatedFiles().size());
- Assert.assertEquals(1, mojo.getAddedFiles().size());
+ Assert.assertEquals(2, updates.size());
+ Assert.assertNull(uptodates);
+ Assert.assertNull(adds);
}
- Assert.assertEquals(1, mojo.getFailedFiles().size());
- Assert.assertEquals(1, mojo.getIgnoreFiles().size());
+ Assert.assertEquals(1, fails.size());
+ Assert.assertEquals(1, ignores.size());
- mojo.setVerbose(false);
- mojo.execute();
+ execute(false, mojo);
- 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());
+ Assert.assertEquals(4, process.size());
+ Assert.assertNull(uptodates);
+// Assert.assertEquals(2, uptodates.size());
+ Assert.assertEquals(2, updates.size());
+ Assert.assertNull(adds);
+ Assert.assertEquals(1, fails.size());
+ Assert.assertEquals(1, ignores.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());
+ Assert.assertEquals(0, process.size());
+ for (FileState state : FileState.values()) {
+ Assert.assertNull(mojo.getFiles(state));
+ }
}
+// @Ignore
+
@Test
public void updateLicense() throws Exception {
@@ -146,11 +173,17 @@
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());
+ execute(true, mojo);
+ Assert.assertEquals(1, process.size());
+ if (uptodates != null) {
+
+ Assert.assertEquals(1, uptodates.size());
+ Assert.assertNull(updates);
+ } else {
+ Assert.assertNull(uptodates);
+ Assert.assertEquals(1, updates.size());
+ }
content = PluginHelper.readAsString(f, mojo.getEncoding());
// check header (description + copyright) does not changed
@@ -160,11 +193,13 @@
// check license changed
checkPattern(f, content, "Fake to be removed!", false);
- mojo.setVerbose(false);
- mojo.execute();
+ execute(false, mojo);
- Assert.assertEquals(1, mojo.getProcessedFiles().size());
- Assert.assertEquals(1, mojo.getUpdatedFiles().size());
+ Assert.assertEquals(1, process.size());
+ Assert.assertNull(uptodates);
+ Assert.assertEquals(1, updates.size());
+// Assert.assertEquals(1, uptodates.size());
+// Assert.assertNull(updates);
int oldLength = content.length();
content = PluginHelper.readAsString(f, mojo.getEncoding());
@@ -173,6 +208,7 @@
Assert.assertEquals(oldLength, newLength);
}
+// @Ignore
@Test
public void failLicense() throws Exception {
@@ -191,12 +227,10 @@
checkPattern(f, content, "License content do NOT update!", true);
// checkPattern(f, content, "Fake to be removed!", true);
- mojo.setVerbose(true);
- mojo.execute();
+ execute(true, mojo);
+ Assert.assertEquals(1, process.size());
+ Assert.assertEquals(1, fails.size());
- Assert.assertEquals(1, mojo.getProcessedFiles().size());
- Assert.assertEquals(1, mojo.getFailedFiles().size());
-
content = PluginHelper.readAsString(f, mojo.getEncoding());
// check header does not changed
@@ -204,13 +238,10 @@
checkPattern(f, content, "License Test :: do NOT update!", true);
checkPattern(f, content, "License content do NOT update!", true);
- mojo.setVerbose(false);
- mojo.execute();
+ execute(false, mojo);
+ Assert.assertEquals(1, process.size());
+ Assert.assertEquals(1, fails.size());
- Assert.assertEquals(1, mojo.getProcessedFiles().size());
- Assert.assertEquals(1, mojo.getFailedFiles().size());
-
-
content = PluginHelper.readAsString(f, mojo.getEncoding());
// check header does not changed
@@ -219,6 +250,9 @@
checkPattern(f, content, "License content do NOT update!", true);
}
+
+// @Ignore
+
@Test
public void ignoreLicense() throws Exception {
@@ -236,11 +270,10 @@
checkPattern(f, content, "yet another license", true);
checkPattern(f, content, "NEVER_FINd_ME!", false);
- mojo.setVerbose(true);
- mojo.execute();
+ execute(true, mojo);
- Assert.assertEquals(1, mojo.getProcessedFiles().size());
- Assert.assertEquals(1, mojo.getIgnoreFiles().size());
+ Assert.assertEquals(1, process.size());
+ Assert.assertEquals(1, ignores.size());
content = PluginHelper.readAsString(f, mojo.getEncoding());
@@ -250,13 +283,11 @@
checkPattern(f, content, "yet another license", true);
checkPattern(f, content, "NEVER_FINd_ME!", false);
- mojo.setVerbose(false);
- mojo.execute();
+ execute(false, mojo);
- Assert.assertEquals(1, mojo.getProcessedFiles().size());
- Assert.assertEquals(1, mojo.getIgnoreFiles().size());
+ Assert.assertEquals(1, process.size());
+ Assert.assertEquals(1, ignores.size());
-
content = PluginHelper.readAsString(f, mojo.getEncoding());
// check header (description + copyright) does not changed
@@ -266,6 +297,8 @@
checkPattern(f, content, "NEVER_FINd_ME!", false);
}
+// @Ignore
+
@Test
public void skip() throws Exception {
@@ -274,6 +307,19 @@
Assert.assertTrue(mojo.isSkip());
}
+ protected void execute(boolean verbose,
+ UpdateFileHeaderMojo mojo) throws Exception {
+ mojo.setVerbose(verbose);
+ mojo.execute();
+
+ process = mojo.getProcessedFiles();
+ uptodates = mojo.getFiles(FileState.uptodate);
+ updates = mojo.getFiles(FileState.update);
+ adds = mojo.getFiles(FileState.add);
+ fails = mojo.getFiles(FileState.fail);
+ ignores = mojo.getFiles(FileState.ignore);
+ }
+
protected File getMyBeanFile(String testName) {
File f = PluginHelper.getFile(getBasedir(),
"target",
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/project.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/project.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/project.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,20 +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">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
+ <headers>
+ <header>
<licenseName>lgpl_v3</licenseName>
+ <commentStyle>java</commentStyle>
<fileSets>
<fileSet>
- <headerType>java</headerType>
<basedir>addLicense/src</basedir>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
</fileSets>
- </licenseSet>
- </licenseSets>
+ </header>
+ </headers>
</project>
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/project.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,20 +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">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
+ <headers>
+ <header>
<licenseName>lgpl_v3</licenseName>
+ <commentStyle>java</commentStyle>
<fileSets>
<fileSet>
- <headerType>java</headerType>
<basedir>all/src</basedir>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
</fileSets>
- </licenseSet>
- </licenseSets>
+ </header>
+ </headers>
</project>
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/project.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,20 +1,22 @@
<?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">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
+
+ <headers>
+ <header>
<licenseName>lgpl_v3</licenseName>
+ <commentStyle>java</commentStyle>
<fileSets>
<fileSet>
- <headerType>java</headerType>
<basedir>failLicense/src</basedir>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
</fileSets>
- </licenseSet>
- </licenseSets>
+ </header>
+ </headers>
+
</project>
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/project.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/project.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/project.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,20 +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">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
+ <headers>
+ <header>
<licenseName>lgpl_v3</licenseName>
+ <commentStyle>java</commentStyle>
<fileSets>
<fileSet>
- <headerType>java</headerType>
<basedir>ignoreLicense/src</basedir>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
</fileSets>
- </licenseSet>
- </licenseSets>
+ </header>
+ </headers>
</project>
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/project.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/project.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/project.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -2,20 +2,20 @@
<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">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
- <licenseSets>
- <licenseSet>
+ <headers>
+ <header>
<licenseName>lgpl_v3</licenseName>
+ <commentStyle>java</commentStyle>
<fileSets>
<fileSet>
- <headerType>java</headerType>
<basedir>updateLicense/src</basedir>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
</fileSets>
- </licenseSet>
- </licenseSets>
+ </header>
+ </headers>
</project>
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>lgpl_v3</mainLicense>
</project>
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml 2010-04-10 20:50:02 UTC (rev 1736)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml 2010-04-12 11:01:09 UTC (rev 1737)
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd">
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
<mainLicense>gpl_v3</mainLicense>
</project>
1
0
Author: tchemit
Date: 2010-04-10 22:50:02 +0200 (Sat, 10 Apr 2010)
New Revision: 1736
Log:
remove obsolete directory
Removed:
trunk/src/it/update-license/
1
0
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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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>
1
0
Author: tchemit
Date: 2010-04-10 17:49:00 +0200 (Sat, 10 Apr 2010)
New Revision: 1734
Log:
clean doc
Removed:
trunk/src/site/rst/actions.rst
trunk/src/site/rst/deprecated-mojos.rst
trunk/src/site/rst/get-informations.rst
Modified:
trunk/src/site/site_en.xml
Deleted: trunk/src/site/rst/actions.rst
===================================================================
--- trunk/src/site/rst/actions.rst 2010-04-10 15:37:33 UTC (rev 1733)
+++ trunk/src/site/rst/actions.rst 2010-04-10 15:49:00 UTC (rev 1734)
@@ -1,57 +0,0 @@
-========
-Actions!
-========
-
-
-:Author: Tony Chemit <chemit(a)codelutin.com>
-:Abstract: Describes action goals
-
-.. contents::
- :depth: 2
-
-.. #%L
-.. Maven License Plugin
-..
-.. $Author: tchemit $
-.. $LastChangedDate$
-.. $LastChangedRevision$
-.. $Id$
-.. $HeadURL$
-.. %%
-.. Copyright (C) 2008 - 2010 CodeLutin
-.. %%
-.. This program is free software: you can redistribute it and/or modify
-.. it under the terms of the GNU Lesser General Public License as
-.. published by the Free Software Foundation, either version 3 of the
-.. License, or (at your option) any later version.
-..
-.. This program is distributed in the hope that it will be useful,
-.. but WITHOUT ANY WARRANTY; without even the implied warranty of
-.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.. GNU General Lesser Public License for more details.
-..
-.. You should have received a copy of the GNU General Lesser Public
-.. License along with this program. If not, see
-.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
-.. #L%
-
-Content
--------
-
-This page describes action goals which interacts with your project source files.
-
-The plugin has the following action goals:
-
- * `update-project-license`_ adds or updates license project file (since 2.1).
-
- * `update-license`_ adds or updates license header on some files (since 2.1).
-
- * `add-third-party`_ creates the THIRD-PARTY.txt in the build.
-
-
-.. _update-project-license: update-project-license-mojo.html
-
-.. _update-license: update-license-mojo.html
-
-.. _add-third-party: add-third-party-mojo.html
-
Deleted: trunk/src/site/rst/deprecated-mojos.rst
===================================================================
--- trunk/src/site/rst/deprecated-mojos.rst 2010-04-10 15:37:33 UTC (rev 1733)
+++ trunk/src/site/rst/deprecated-mojos.rst 2010-04-10 15:49:00 UTC (rev 1734)
@@ -1,53 +0,0 @@
-================
-Deprecated mojos
-================
-
-
-:Author: Tony Chemit <chemit(a)codelutin.com>
-:Abstract: Describes deprecated mojos since 2.1
-
-.. contents::
- :depth: 2
-
-.. #%L
-.. Maven License Plugin
-..
-.. $Author: tchemit $
-.. $LastChangedDate$
-.. $LastChangedRevision$
-.. $Id$
-.. $HeadURL$
-.. %%
-.. Copyright (C) 2008 - 2010 CodeLutin
-.. %%
-.. This program is free software: you can redistribute it and/or modify
-.. it under the terms of the GNU Lesser General Public License as
-.. published by the Free Software Foundation, either version 3 of the
-.. License, or (at your option) any later version.
-..
-.. This program is distributed in the hope that it will be useful,
-.. but WITHOUT ANY WARRANTY; without even the implied warranty of
-.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.. GNU General Lesser Public License for more details.
-..
-.. You should have received a copy of the GNU General Lesser Public
-.. License along with this program. If not, see
-.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
-.. #L%
-
-Content
--------
-
-This page describes deprectaed mojos since version **2.1**.
-
-The plugin has the following deprecated goals:
-
- * `add-license`_ add (and creates it if not found) the LICENSE.txt in the build
- * `update-header`_ add or update license header on some files
- * `generator-list`_ display list of available generators
-
-.. _add-license: add-license-mojo.html
-
-.. _update-header: update-header-mojo.html
-
-.. _generator-list: generator-list-mojo.html
Deleted: trunk/src/site/rst/get-informations.rst
===================================================================
--- trunk/src/site/rst/get-informations.rst 2010-04-10 15:37:33 UTC (rev 1733)
+++ trunk/src/site/rst/get-informations.rst 2010-04-10 15:49:00 UTC (rev 1734)
@@ -1,54 +0,0 @@
-=================
-Get informations!
-=================
-
-:Author: Tony Chemit <chemit(a)codelutin.com>
-:Abstract: Describes information goals
-
-.. contents::
- :depth: 2
-
-.. #%L
-.. Maven License Plugin
-..
-.. $Author: tchemit $
-.. $LastChangedDate$
-.. $LastChangedRevision$
-.. $Id$
-.. $HeadURL$
-.. %%
-.. Copyright (C) 2008 - 2010 CodeLutin
-.. %%
-.. This program is free software: you can redistribute it and/or modify
-.. it under the terms of the GNU Lesser General Public License as
-.. published by the Free Software Foundation, either version 3 of the
-.. License, or (at your option) any later version.
-..
-.. This program is distributed in the hope that it will be useful,
-.. but WITHOUT ANY WARRANTY; without even the implied warranty of
-.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.. GNU General Lesser Public License for more details.
-..
-.. You should have received a copy of the GNU General Lesser Public
-.. License along with this program. If not, see
-.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
-.. #L%
-
-Content
--------
-
-This page describes information goals which display in console some helpfull
-informations to build your license project descriptor file.
-
-The plugin has the following information goals:
-
- * `comment-style-list`_ display list of available comment style header (since 2.1).
- * `license-list`_ display list of available licenses.
- * `help`_ display help about the plugin (goals, usage).
-
-
-.. _comment-style-list: comment-style-list-mojo.html
-
-.. _license-list: license-list-mojo.html
-
-.. _help: help-mojo.html
Modified: trunk/src/site/site_en.xml
===================================================================
--- trunk/src/site/site_en.xml 2010-04-10 15:37:33 UTC (rev 1733)
+++ trunk/src/site/site_en.xml 2010-04-10 15:49:00 UTC (rev 1734)
@@ -55,17 +55,17 @@
<item name="File header model" href="header.html"/>
<item name="License project descriptor" href="descriptor.html"/>
<item name="Usage" href="usage.html">
- <item name="Actions" href="actions.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="add-third-party" href="add-third-party-mojo.html"/>
</item>
- <item name="Get informations" href="get-informations.html">
+ <item name="Get informations" href="usage.html#get-informations">
<item name="license-list" href="license-list-mojo.html"/>
<item name="comment-style-list" href="comment-style-list-mojo.html"/>
<item name="help" href="help-mojo.html"/>
</item>
- <item name="Deprecated goals" href="deprecated-mojos.html">
+ <item name="Deprecated goals" href="usage.html#deprecated-goals-since-2-1">
<item name="add-license" href="add-license-mojo.html"/>
<item name="update-header" href="update-header-mojo.html"/>
<item name="generator-list" href="generator-list-mojo.html"/>
1
0
Author: tchemit
Date: 2010-04-10 17:37:33 +0200 (Sat, 10 Apr 2010)
New Revision: 1733
Log:
- continue documentation
- remove license header (for test purpose...)
- finish tests
Added:
trunk/src/it/update-project-license/
trunk/src/it/update-project-license/LICENSE.txt
trunk/src/it/update-project-license/README.txt
trunk/src/it/update-project-license/changelog.txt
trunk/src/it/update-project-license/invoker.properties
trunk/src/it/update-project-license/pom.xml
trunk/src/it/update-project-license/src/
trunk/src/it/update-project-license/src/license/
trunk/src/it/update-project-license/src/license/project.xml
trunk/src/it/update-project-license/src/main/
trunk/src/it/update-project-license/src/main/java/
trunk/src/it/update-project-license/src/main/java/org/
trunk/src/it/update-project-license/src/main/java/org/nuiton/
trunk/src/it/update-project-license/src/main/java/org/nuiton/license/
trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/
trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/
trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java
trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
trunk/src/it/update-project-license/verify.groovy
trunk/src/license/
trunk/src/license/project.xml
trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java
trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java
trunk/src/site/rst/actions.rst
trunk/src/site/rst/deprecated-mojos.rst
trunk/src/site/rst/get-informations.rst
trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java
trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml
Removed:
trunk/src/it/add-license-file/
Modified:
trunk/pom.xml
trunk/src/it/update-license/pom.xml
trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java
trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java
trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java
trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java
trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java
trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java
trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java
trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java
trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java
trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java
trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java
trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java
trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java
trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java
trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java
trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java
trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/model/License.java
trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java
trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java
trunk/src/main/mdo/descriptor.mdo
trunk/src/site/rst/descriptor.rst
trunk/src/site/rst/header.rst
trunk/src/site/rst/index.rst
trunk/src/site/rst/usage.rst
trunk/src/site/site_en.xml
trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java
trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java
trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java
trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java
trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java
trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java
trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testOne.xml
trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testTwo.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/bug_28.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/java.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/properties.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/xml.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/pom.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -297,11 +297,11 @@
<properties>
<processor.version>1.0.2</processor.version>
-
- <!-- TODO Remove this when mavenpom greater than 2.8 -->
+
+ <!-- TODO Remove this when mavenpom greater than 2.1 -->
<helper.version>1.2.3-SNAPSHOT</helper.version>
- <!-- version of project license descriptor model -->
+ <!-- version of project license descriptor model -->
<mdoVersion>1.0.0</mdoVersion>
<!-- documentation is in english -->
@@ -452,6 +452,12 @@
<profile>
<id>run-its</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
<build>
<defaultGoal>integration-test</defaultGoal>
<plugins>
Modified: trunk/src/it/update-license/pom.xml
===================================================================
--- trunk/src/it/update-license/pom.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/it/update-license/pom.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -10,14 +10,14 @@
<!-- ************************************************************* -->
<groupId>org.nuiton.license.test</groupId>
- <artifactId>test-update-header-file</artifactId>
+ <artifactId>test-update-license</artifactId>
<version>@pom.version@</version>
<!-- ************************************************************* -->
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
- <name>License Test :: update-header-file</name>
+ <name>License Test :: update-license</name>
<!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
Added: trunk/src/it/update-project-license/LICENSE.txt
===================================================================
--- trunk/src/it/update-project-license/LICENSE.txt (rev 0)
+++ trunk/src/it/update-project-license/LICENSE.txt 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,167 @@
+;; This line will be removed!
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Property changes on: trunk/src/it/update-project-license/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/README.txt
===================================================================
--- trunk/src/it/update-project-license/README.txt (rev 0)
+++ trunk/src/it/update-project-license/README.txt 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,2 @@
+To test parserJava on a new project (says a project with no i18n translations)
+At the end we should have in target/generated-sources/i18n getters detected.
Property changes on: trunk/src/it/update-project-license/README.txt
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/changelog.txt
===================================================================
--- trunk/src/it/update-project-license/changelog.txt (rev 0)
+++ trunk/src/it/update-project-license/changelog.txt 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1 @@
+see the changelog of org.nuiton:i18n project.
\ No newline at end of file
Property changes on: trunk/src/it/update-project-license/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/invoker.properties
===================================================================
--- trunk/src/it/update-project-license/invoker.properties (rev 0)
+++ trunk/src/it/update-project-license/invoker.properties 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,21 @@
+# A comma or space separated list of goals/phases to execute, may
+# specify an empty list to execute the default goal of the IT project
+invoker.goals=clean process-resources
+
+# Optionally, a list of goals to run during further invocations of Maven
+#invoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:run
+
+# A comma or space separated list of profiles to activate
+#invoker.profiles=run-all run-once
+
+# The value for the environment variable MAVEN_OPTS
+#invoker.mavenOpts=-Dfile.encoding=UTF-16 -Xms32m -Xmx256m
+
+# Possible values are "fail-fast" (default), "fail-at-end" and "fail-never"
+invoker.failureBehavior=fail-at-end
+
+# The expected result of the build, possible values are "success" (default) and "failure"
+#invoker.buildResult=success
+
+# A boolean value controlling the -N flag, defaults to "false"
+#invoker.nonRecursive=false
Property changes on: trunk/src/it/update-project-license/invoker.properties
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/pom.xml
===================================================================
--- trunk/src/it/update-project-license/pom.xml (rev 0)
+++ trunk/src/it/update-project-license/pom.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+
+ <groupId>org.nuiton.license.test</groupId>
+ <artifactId>test-update-project-license</artifactId>
+ <version>@pom.version@</version>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>License Test :: update-project-license</name>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <packaging>jar</packaging>
+
+ <inceptionYear>2012</inceptionYear>
+
+ <organization>
+ <name>License Test</name>
+ </organization>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <build>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <verbose>true</verbose>
+ <generateBundle>true</generateBundle>
+ <bundleLicensePath>META-INF/bundleLicense.txt</bundleLicensePath>
+ </configuration>
+ <executions>
+ <execution>
+ <id>first</id>
+ <goals>
+ <goal>update-project-license</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
+
Property changes on: trunk/src/it/update-project-license/pom.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/src/license/project.xml
===================================================================
--- trunk/src/it/update-project-license/src/license/project.xml (rev 0)
+++ trunk/src/it/update-project-license/src/license/project.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,19 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd">
+ <mainLicense>gpl_v3</mainLicense>
+ <licenseSets>
+ <licenseSet>
+ <fileSets>
+ <fileSet>
+ <headerType>java</headerType>
+ <basedir>src/main/java</basedir>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ </licenseSet>
+ </licenseSets>
+</project>
Property changes on: trunk/src/it/update-project-license/src/license/project.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java
===================================================================
--- trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java (rev 0)
+++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,10 @@
+package org.nuiton.license.plugin.test;
+
+/**
+ * this class has no license, a new default one will be added.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+public class MyBean {
+}
Property changes on: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
===================================================================
--- trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java (rev 0)
+++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,20 @@
+/*
+ * #%L
+ * License Test :: do NOT update!
+ * %%
+ * Copyright (C) 2010 Tony
+ * %%
+ * Fake to be removed!
+ * #L%
+ */
+
+/**
+ * this class owns a header, only license will be updated.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+package org.nuiton.license.plugin.test;
+
+public class MyBean2 {
+}
Property changes on: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
===================================================================
--- trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java (rev 0)
+++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,18 @@
+/*
+ * %%Ignore-License
+ *
+ * yet another license
+ *
+ * Copyright (C) 2000 Codelutin Do not update!
+ */
+
+/**
+ * this class owns a ignore license header and will not be updated.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+package org.nuiton.license.plugin.test;
+
+public class MyBean3 {
+}
Property changes on: trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/it/update-project-license/verify.groovy
===================================================================
--- trunk/src/it/update-project-license/verify.groovy (rev 0)
+++ trunk/src/it/update-project-license/verify.groovy 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,43 @@
+
+file = new File(basedir, 'LICENSE.txt');
+assert file.exists();
+
+content = file.text;
+assert !content.contains( ';; This line will be removed!' );
+assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' );
+assert content.contains( 'GNU GENERAL PUBLIC LICENSE' );
+
+file = new File(basedir, 'target/generated-sources/license/LICENSE.txt');
+assert file.exists();
+
+content = file.text;
+assert !content.contains( ';; This line will be removed!' );
+assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' );
+assert content.contains( 'GNU GENERAL PUBLIC LICENSE' );
+
+file = new File(basedir, 'target/generated-sources/license/META-INF/bundleLicense.txt');
+assert file.exists();
+
+content = file.text;
+assert !content.contains( ';; This line will be removed!' );
+assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' );
+assert content.contains( 'GNU GENERAL PUBLIC LICENSE' );
+
+file = new File(basedir, 'target/classes/LICENSE.txt');
+assert file.exists();
+
+content = file.text;
+assert !content.contains( ';; This line will be removed!' );
+assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' );
+assert content.contains( 'GNU GENERAL PUBLIC LICENSE' );
+
+
+file = new File(basedir, 'target/classes/META-INF/bundleLicense.txt');
+assert file.exists();
+
+content = file.text;
+assert !content.contains( ';; This line will be removed!' );
+assert !content.contains( 'GNU LESSER GENERAL PUBLIC LICENSE' );
+assert content.contains( 'GNU GENERAL PUBLIC LICENSE' );
+
+return true;
Property changes on: trunk/src/it/update-project-license/verify.groovy
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/license/project.xml
===================================================================
--- trunk/src/license/project.xml (rev 0)
+++ trunk/src/license/project.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,53 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd">
+ <mainLicense>lgpl_v3</mainLicense>
+ <licenseSets>
+ <licenseSet>
+ <fileSets>
+
+ <fileSet>
+ <headerType>java</headerType>
+ <basedir>src/main/java</basedir>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <headerType>java</headerType>
+ <basedir>src/test/java</basedir>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <headerType>java</headerType>
+ <basedir>src/target/generated-sources/modello</basedir>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <headerType>rst</headerType>
+ <basedir>src/site</basedir>
+ <includes>
+ <include>**/*.rst</include>
+ </includes>
+ </fileSet>
+
+ <fileSet>
+ <headerType>xml</headerType>
+ <basedir>src/site</basedir>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+
+ </fileSets>
+ </licenseSet>
+ </licenseSets>
+</project>
Property changes on: trunk/src/license/project.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -94,4 +94,8 @@
return store;
}
+ protected boolean hasClassPath() {
+ return rejectPackaging(Packaging.pom);
+ }
+
}
Added: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,310 @@
+package org.nuiton.license.plugin;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.plugin.MojoFailureException;
+import org.nuiton.license.plugin.header.FileHeader;
+import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer;
+import org.nuiton.license.plugin.model.License;
+import org.nuiton.license.plugin.model.LicenseStore;
+import org.nuiton.license.plugin.model.project.FileSet;
+import org.nuiton.license.plugin.model.project.LicenseProject;
+import org.nuiton.license.plugin.model.project.LicenseSet;
+import org.nuiton.license.plugin.model.project.io.xpp3.LicenseProjectXpp3Reader;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Abstract mojo which using {@link #descriptor} file and owns a
+ * {@link #licenseStore}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+public abstract class AbstractLicenseWithDescriptorMojo extends AbstractLicenseMojo {
+
+ /**
+ * The project license descriptor file.
+ *
+ * @parameter expression="${license.descriptor}" default-value="src/license/project.xml"
+ * @required
+ * @since 2.1
+ */
+ private File descriptor;
+
+ /**
+ * To specify an external extra licenses repository resolver (says the base
+ * url of the repository where the {@code license.properties} is present).
+ *
+ * @parameter expression="${license.licenseResolver}"
+ * @since 2.1
+ */
+ private String licenseResolver;
+
+ /**
+ * A flag to keep a backup of every modified file.
+ *
+ * @parameter expression="${license.keepBackup}" default-value="false"
+ * @since 2.1
+ */
+ private boolean keepBackup;
+
+ /**
+ * All available header transformers.
+ *
+ * @component role="org.nuiton.license.plugin.header.transformer.FileHeaderTransformer"
+ * @since 2.1
+ */
+ private Map<String, FileHeaderTransformer> transformers;
+
+ /** store of licenses */
+ private LicenseStore licenseStore;
+
+ /** descriptor of project */
+ private LicenseProject licenseProject;
+
+ /** @return {@code true} if goal will not be executed */
+ public abstract boolean isSkip();
+
+ /**
+ * Changes internal state {@code skip} to execute (or not) goal.
+ *
+ * @param skip new state value
+ */
+ public abstract void setSkip(boolean skip);
+
+ @Override
+ protected boolean checkSkip() {
+ if (isSkip()) {
+ getLog().info("skip flag is on, will skip goal.");
+ return false;
+ }
+ return super.checkSkip();
+ }
+
+ @Override
+ protected void init() throws Exception {
+
+ if (isSkip()) {
+ return;
+ }
+
+ // init licenses store
+ LicenseStore licenseStore = createLicenseStore(getLicenseResolver());
+ setLicenseStore(licenseStore);
+
+ // load project descriptor
+ LicenseProject licenseProject = null;
+ FileReader reader = new FileReader(getDescriptor());
+ try {
+ licenseProject = new LicenseProjectXpp3Reader().read(reader);
+ setLicenseProject(licenseProject);
+ } finally {
+ reader.close();
+ }
+
+ // check that license project is sane (known licenses + header types)
+ // + populate default license name in LicenseSet (with main License) if
+ // none given for licenseSet
+ validateProjectFile(licenseProject,
+ licenseStore,
+ getTransformers()
+ );
+ }
+
+ public File getDescriptor() {
+ return descriptor;
+ }
+
+ public boolean isKeepBackup() {
+ return keepBackup;
+ }
+
+ public Map<String, FileHeaderTransformer> getTransformers() {
+ return transformers;
+ }
+
+ public String getLicenseResolver() {
+ return licenseResolver;
+ }
+
+ public LicenseStore getLicenseStore() {
+ return licenseStore;
+ }
+
+ public LicenseProject getLicenseProject() {
+ return licenseProject;
+ }
+
+ public void setKeepBackup(boolean keepBackup) {
+ this.keepBackup = keepBackup;
+ }
+
+ public void setDescriptor(File descriptor) {
+ this.descriptor = descriptor;
+ }
+
+ public void setLicenseResolver(String licenseResolver) {
+ this.licenseResolver = licenseResolver;
+ }
+
+ public void setTransformers(Map<String, FileHeaderTransformer> transformers) {
+ this.transformers = transformers;
+ }
+
+ public void setLicenseStore(LicenseStore licenseStore) {
+ this.licenseStore = licenseStore;
+ }
+
+
+ public void setLicenseProject(LicenseProject licenseProject) {
+ this.licenseProject = licenseProject;
+ }
+
+ public License getMainLicense()
+ throws IllegalArgumentException, IllegalStateException {
+ LicenseProject licenseProject = getLicenseProject();
+ if (licenseProject == null) {
+ throw new IllegalStateException("No license project initialized!");
+ }
+ String mainLicenseName = licenseProject.getMainLicense();
+ if (StringUtils.isEmpty(mainLicenseName)) {
+ throw new IllegalArgumentException(
+ "main license name can not be null, nor empty");
+ }
+ License mainLicense = getLicense(mainLicenseName);
+ return mainLicense;
+ }
+
+ public License getLicense(String licenseName)
+ throws IllegalArgumentException, IllegalStateException {
+ if (StringUtils.isEmpty(licenseName)) {
+ throw new IllegalArgumentException("licenseName can not be null, nor empty");
+ }
+ LicenseStore licenseStore = getLicenseStore();
+ if (licenseStore == null) {
+ throw new IllegalStateException("No license store initialized!");
+ }
+ License mainLicense = licenseStore.getLicense(licenseName);
+ return mainLicense;
+ }
+
+ public FileHeaderTransformer getTransformer(String transformerName)
+ throws IllegalArgumentException, IllegalStateException {
+ if (StringUtils.isEmpty(transformerName)) {
+ throw new IllegalArgumentException("transformerName can not be null, nor empty!");
+ }
+ Map<String, FileHeaderTransformer> transformers = getTransformers();
+ if (transformers == null) {
+ throw new IllegalStateException("No transformers initialized!");
+ }
+ FileHeaderTransformer transformer =
+ transformers.get(transformerName);
+ return transformer;
+ }
+
+ /**
+ * Build a default header given the parameters.
+ *
+ * @param license the license type ot use in header
+ * @param projectName project name as header description
+ * @param inceptionYear first year of copyright
+ * @param copyrightHolder holder of copyright
+ * @param encoding encoding used to read or write files
+ * @param addSvnKeyWords a flag to add in description section svn keywords
+ * @return the new file header
+ * @throws IOException if any problem while creating file header
+ */
+ protected FileHeader buildDefaultFileHeader(
+ License license,
+ String projectName,
+ String inceptionYear,
+ String copyrightHolder,
+ boolean addSvnKeyWords,
+ String encoding) throws IOException {
+ FileHeader result = new FileHeader();
+
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(projectName);
+ if (addSvnKeyWords) {
+ // add svn keyworks
+ char ls = FileHeaderTransformer.LINE_SEPARATOR;
+ buffer.append(ls);
+
+ // breaks the keyword otherwise svn will update them here
+ buffer.append(ls).append("$" + "Author$");
+ buffer.append(ls).append("$" + "LastChangedDate$");
+ buffer.append(ls).append("$" + "LastChangedRevision$");
+ buffer.append(ls).append("$" + "Id$");
+ buffer.append(ls).append("$" + "HeadURL$");
+
+ }
+ result.setDescription(buffer.toString());
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("header description : " + result.getDescription());
+ }
+
+ String licenseContent = license.getHeaderContent(encoding);
+ result.setLicense(licenseContent);
+
+ Integer firstYear = Integer.valueOf(inceptionYear);
+ result.setCopyrightFirstYear(firstYear);
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(new Date());
+ Integer lastYear = cal.get(Calendar.YEAR);
+ if (firstYear < lastYear) {
+ result.setCopyrightLastYear(lastYear);
+ }
+ result.setCopyrightHolder(copyrightHolder);
+ return result;
+ }
+
+ protected void validateProjectFile(
+ LicenseProject licenseProject,
+ LicenseStore licenseStore,
+ Map<String, FileHeaderTransformer> transformers)
+ throws MojoFailureException {
+
+ List<String> licenseNames = Arrays.asList(licenseStore.getLicenseNames());
+
+ // check licenses is known
+ String mainLicense = licenseProject.getMainLicense();
+ if (licenseStore.getLicense(mainLicense) == null) {
+ throw new MojoFailureException(
+ "main license '" + mainLicense +
+ "' is unknown, use one of " + licenseNames);
+ }
+ for (LicenseSet licenseSet : licenseProject.getLicenseSets()) {
+
+ String licenseName = licenseSet.getLicenseName();
+ if (StringUtils.isEmpty(licenseName)) {
+
+ // use the main license
+ licenseSet.setLicenseName(mainLicense);
+ } else {
+
+ // check license name
+ if (licenseStore.getLicense(licenseName) == null) {
+ throw new MojoFailureException(
+ "license '" + licenseName +
+ "' is unknown, use one of " + licenseNames);
+ }
+ }
+
+ // check header types (for each file set)
+ for (FileSet fileSet : licenseSet.getFileSets()) {
+ String headerType = fileSet.getHeaderType();
+
+ if (getTransformer(headerType) == null) {
+ throw new MojoFailureException(
+ "headerType '" + headerType +
+ "' is unknown, use one of " + transformers.keySet());
+ }
+ }
+ }
+ }
+
+}
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseWithDescriptorMojo.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/AddLicenseFileMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.nuiton.license.plugin.model.License;
@@ -16,7 +15,9 @@
* @phase generate-resources
* @requiresProject true
* @requiresDependencyResolution compile
+ * @deprecated since 2.1, prefer use now the goal {@code update-project-license}.
*/
+@Deprecated
public class AddLicenseFileMojo extends AbstractLicenseMojo {
/**
@@ -84,7 +85,7 @@
* Cette option n'est utilisable que sur des modules avec un class-path (pas
* pour un pom)
*
- * @parameter expression="${license.copyToMETA_INF}" default-value="false"
+ * @parameter expression="${license.generateBundle}" default-value="false"
* @since 1.0.0
*/
protected boolean copyToMETA_INF;
@@ -99,20 +100,11 @@
protected License license;
- protected boolean hasClassPath() {
- return rejectPackaging(Packaging.pom);
- }
-
boolean doGenerate;
@Override
protected void init() throws Exception {
- if (getLog().isDebugEnabled()) {
- // always be verbose in debug mode
- setVerbose(true);
- }
-
// must generate if file does not exist
doGenerate = true;
Modified: trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyFileMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.apache.maven.artifact.Artifact;
@@ -77,7 +76,7 @@
* Un flag pour faire une copie nommé dans META-INF (prefixe avec le nom de
* l'artifact).
*
- * @parameter expression="${license.copyToMETA_INF}" default-value="false"
+ * @parameter expression="${license.generateBundle}" default-value="false"
* @since 1.0.0
*/
protected boolean copyToMETA_INF;
@@ -159,7 +158,7 @@
// always be verbose in debug mode
setVerbose(true);
}
-
+
doGenerate = true;
thirdPartyFile = new File(outputDirectory, thirdPartyFilename);
Modified: trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.apache.maven.plugin.MojoExecutionException;
Modified: trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/GeneratorListMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.apache.maven.plugin.MojoExecutionException;
Modified: trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.apache.maven.plugin.MojoExecutionException;
@@ -40,7 +39,7 @@
@Override
protected void init() throws Exception {
-
+
// obtain licenses store
licenseStore = createLicenseStore(extraResolver);
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/UpdateHeaderMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.apache.maven.plugin.MojoExecutionException;
Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,22 +1,16 @@
-
package org.nuiton.license.plugin;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.plugin.MojoFailureException;
import org.nuiton.license.plugin.header.FileHeader;
import org.nuiton.license.plugin.header.FileHeaderFilter;
import org.nuiton.license.plugin.header.FileHeaderProcessor;
import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer;
import org.nuiton.license.plugin.model.License;
-import org.nuiton.license.plugin.model.LicenseStore;
import org.nuiton.license.plugin.model.project.FileSet;
-import org.nuiton.license.plugin.model.project.LicenseProject;
import org.nuiton.license.plugin.model.project.LicenseSet;
-import org.nuiton.license.plugin.model.project.io.xpp3.LicenseProjectXpp3Reader;
import org.nuiton.plugin.PluginHelper;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.util.*;
@@ -35,18 +29,9 @@
* @goal update-license
* @since 2.1
*/
-public class UpdateLicenseMojo extends AbstractLicenseMojo {
+public class UpdateLicenseMojo extends AbstractLicenseWithDescriptorMojo {
/**
- * The project license descriptor file.
- *
- * @parameter expression="${license.descriptor}" default-value="src/license/project.xml"
- * @required
- * @since 2.1
- */
- protected File descriptor;
-
- /**
* Name of project (or module).
* <p/>
* Will be used as description section of new header.
@@ -80,7 +65,10 @@
protected String inceptionYear;
/**
- * A flag to add svn:keywors on new header.
+ * A flag to add svn:keywords on new header.
+ * <p/>
+ * Will add svn keywords :
+ * <pre>Author, Id, Rev, URL and Date</pre>
*
* @parameter expression="${license.addSvnKeyWords}" default-value="false"
* @since 2.1
@@ -100,30 +88,15 @@
* A tag to place on files that will be ignored by the plugin.
* <p/>
* Sometimes, it is necessary to do this when file is under a specific license.
+ * <p/>
+ * <b>Note:</b> If no sets, will use the default tag {@code %}%Ignore-License
*
- * @parameter expression="${license.ignoreTag}" default-value="%%Ignore-License"
+ * @parameter expression="${license.ignoreTag}"
* @since 2.1
*/
protected String ignoreTag;
/**
- * To specify an external extra licenses repository resolver (says the base
- * url of the repository where the {@code license.properties} is present).
- *
- * @parameter expression="${license.licenseResolver}"
- * @since 2.1
- */
- protected String licenseResolver;
-
- /**
- * A flag to keep a backup of every modified file.
- *
- * @parameter expression="${license.keepBackup}" default-value="false"
- * @since 2.1
- */
- protected boolean keepBackup;
-
- /**
* A flag to skip the goal.
*
* @parameter expression="${license.skipUpdateLicense}" default-value="false"
@@ -139,55 +112,34 @@
*/
protected boolean dryRun;
- /**
- * All available header transformers.
- *
- * @component role="org.nuiton.license.plugin.header.transformer.FileHeaderTransformer"
- * @since 2.1
- */
- protected Map<String, FileHeaderTransformer> transformers;
-
/** timestamp used for generation */
protected long timestamp;
- /** store of licenses */
- protected LicenseStore licenseStore;
-
- /** descriptor of project */
- protected LicenseProject licenseProject;
-
/** set of processed files */
protected Set<File> processedFiles;
@Override
- protected boolean checkSkip() {
- if (skipUpdateLicense) {
- getLog().info("skip flag is on, will skip goal.");
- return false;
- }
- return super.checkSkip();
- }
-
- @Override
public void init() throws Exception {
- if (getLog().isDebugEnabled()) {
- // always be verbose in debug mode
- setVerbose(true);
+ if (isSkip()) {
+ return;
}
- if (isSkipUpdateLicense()) {
- return;
+ if (StringUtils.isEmpty(getIgnoreTag())) {
+
+ // use default value
+ setIgnoreTag("%" + "%Ignore-License");
}
if (isVerbose()) {
+
+ // print availables comment styles (transformers)
StringBuilder buffer = new StringBuilder();
buffer.append("config - available comment styles :");
String commentFormat = "\n * %1$s (%2$s)";
- for (Map.Entry<String, FileHeaderTransformer> e :
- transformers.entrySet()) {
- Map.Entry<String, FileHeaderTransformer> next = e;
- FileHeaderTransformer transformer = next.getValue();
+ for (String transformerName : getTransformers().keySet()) {
+ FileHeaderTransformer transformer =
+ getTransformer(transformerName);
String str = String.format(commentFormat,
transformer.getName(),
transformer.getDescription()
@@ -210,21 +162,7 @@
// set timestamp used for temporary files
setTimestamp(System.nanoTime());
- // init licenses store
- licenseStore = createLicenseStore(licenseResolver);
-
- // load project descriptor
- FileReader reader = new FileReader(getDescriptor());
- try {
- licenseProject = new LicenseProjectXpp3Reader().read(reader);
- } finally {
- reader.close();
- }
-
- // check that license project is sane (known licenses + header types)
- // + populate default license name in LicenseSet (with main License) if
- // none given for licenseSet
- validateProjectFile(licenseProject, licenseStore, transformers);
+ super.init();
}
@Override
@@ -246,11 +184,11 @@
processedFiles = new HashSet<File>();
- for (LicenseSet licenseSet : licenseProject.getLicenseSets()) {
+ for (LicenseSet licenseSet : getLicenseProject().getLicenseSets()) {
// obtain license from definition
String licenseName = licenseSet.getLicenseName();
- License license = licenseStore.getLicense(licenseName);
+ License license = getLicense(licenseName);
if (isVerbose()) {
getLog().info("process " + license.getDescription());
@@ -262,6 +200,7 @@
getProjectName(),
getInceptionYear(),
getOrganizationName(),
+ isAddSvnKeyWords(),
getEncoding()
);
@@ -296,8 +235,7 @@
);
// get header transformer according to file set
- FileHeaderTransformer transformer =
- transformers.get(fileSet.getHeaderType());
+ FileHeaderTransformer transformer = getTransformer(fileSet.getHeaderType());
// change transformer in processor
processor.setTransformer(transformer);
@@ -370,7 +308,7 @@
//check that file is not marked to be ignored
if (content.contains(getIgnoreTag())) {
- getLog().info("ignore file (using " + getIgnoreTag() + ")");
+ getLog().info("ignore file (detected " + getIgnoreTag() + ") " + file);
deleteFile(processFile);
return;
@@ -402,7 +340,7 @@
protected void finalizeFile(File file, File processFile) throws IOException {
if (isKeepBackup() && !isDryRun()) {
- File backupFile = new File(file.getAbsolutePath() + "~");
+ File backupFile = getBackupFile(file);
if (backupFile.exists()) {
@@ -432,10 +370,6 @@
return timestamp;
}
- private File getDescriptor() {
- return descriptor;
- }
-
public String getProjectName() {
return projectName;
}
@@ -456,30 +390,32 @@
return ignoreTag;
}
- public boolean isKeepBackup() {
- return keepBackup;
- }
-
public boolean isDryRun() {
return dryRun;
}
- public boolean isSkipUpdateLicense() {
+ @Override
+ public boolean isSkip() {
return skipUpdateLicense;
}
+ @Override
+ public void setSkip(boolean skipUpdateLicense) {
+ this.skipUpdateLicense = skipUpdateLicense;
+ }
+
public Set<File> getProcessedFiles() {
return processedFiles;
}
+ public boolean isAddSvnKeyWords() {
+ return addSvnKeyWords;
+ }
+
public void setDryRun(boolean dryRun) {
this.dryRun = dryRun;
}
- public void setKeepBackup(boolean keepBackup) {
- this.keepBackup = keepBackup;
- }
-
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
@@ -500,7 +436,6 @@
this.organizationName = organizationName;
}
-
public void setUpdateCopyright(boolean updateCopyright) {
this.updateCopyright = updateCopyright;
}
@@ -509,102 +444,11 @@
this.ignoreTag = ignoreTag;
}
- protected void validateProjectFile(
- LicenseProject licenseProject,
- LicenseStore licenseStore,
- Map<String, FileHeaderTransformer> transformers)
- throws MojoFailureException {
-
- List<String> licenseNames = Arrays.asList(licenseStore.getLicenseNames());
-
- // check licenses is known
- String mainLicense = licenseProject.getMainLicense();
- if (licenseStore.getLicense(mainLicense) == null) {
- throw new MojoFailureException(
- "main license '" + mainLicense +
- "' is unknown, use one of " + licenseNames);
- }
- for (LicenseSet licenseSet : licenseProject.getLicenseSets()) {
-
- String licenseName = licenseSet.getLicenseName();
- if (StringUtils.isEmpty(licenseName)) {
-
- // use the main license
- licenseSet.setLicenseName(mainLicense);
- } else {
-
- // check license name
- if (licenseStore.getLicense(licenseName) == null) {
- throw new MojoFailureException(
- "license '" + licenseName +
- "' is unknown, use one of " + licenseNames);
- }
- }
-
- // check header types (for each file set)
- for (FileSet fileSet : licenseSet.getFileSets()) {
- String headerType = fileSet.getHeaderType();
- if (!transformers.containsKey(headerType)) {
- throw new MojoFailureException(
- "headerType '" + headerType +
- "' is unknown, use one of " + transformers.keySet());
- }
- }
- }
+ public void setAddSvnKeyWords(boolean addSvnKeyWords) {
+ this.addSvnKeyWords = addSvnKeyWords;
}
- /**
- * Build a default header given the parameters.
- *
- * @param license the license type ot use in header
- * @param projectName project name as header description
- * @param inceptionYear first year of copyright
- * @param copyrightHolder holder of copyright
- * @param encoding encoding used to read or write files
- * @return the new file header
- * @throws IOException if any problem while creating file header
- */
- protected FileHeader buildDefaultFileHeader(
- License license,
- String projectName,
- String inceptionYear,
- String copyrightHolder,
- String encoding) throws IOException {
- FileHeader result = new FileHeader();
- StringBuilder buffer = new StringBuilder();
- buffer.append(projectName);
- if (addSvnKeyWords) {
- // add svn keyworks
- buffer.append(FileHeaderTransformer.LINE_SEPARATOR);
- buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$Author$");
- buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$LastChangedDate$");
- buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$LastChangedRevision$");
- buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$Id$");
- buffer.append(FileHeaderTransformer.LINE_SEPARATOR).append("$HeadURL$");
-
- }
- result.setDescription(buffer.toString());
- if (getLog().isDebugEnabled()) {
- getLog().debug("header description : " + result.getDescription());
- }
-
- String licenseContent = license.getHeaderContent(encoding);
- result.setLicense(licenseContent);
-
- Integer firstYear = Integer.valueOf(inceptionYear);
- result.setCopyrightFirstYear(firstYear);
-
- Calendar cal = Calendar.getInstance();
- cal.setTime(new Date());
- Integer lastYear = cal.get(Calendar.YEAR);
- if (firstYear < lastYear) {
- result.setCopyrightLastYear(lastYear);
- }
- result.setCopyrightHolder(copyrightHolder);
- return result;
- }
-
public class UpdateLicenseHeaderFilter extends FileHeaderFilter {
protected final boolean updateCopyright;
Added: trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,222 @@
+package org.nuiton.license.plugin;
+
+import org.nuiton.license.plugin.model.License;
+import org.nuiton.plugin.PluginHelper;
+
+import java.io.File;
+
+/**
+ * Updates (or creates) the main project license file according to the given
+ * license project {@link #descriptor}.
+ * <p/>
+ * Can also generate a bundle license file (to avoid collision names in
+ * class-path). This file is by default generate in
+ * {@code META-INF class-path directory}.
+ * <p/>
+ * <b>Note:</b> this goal replace {@code add-license} one (which does not
+ * use license project descriptor).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @goal update-project-license
+ * @phase generate-resources
+ * @requiresProject true
+ * @since 2.1
+ */
+public class UpdateProjectLicenseMojo extends AbstractLicenseWithDescriptorMojo {
+
+ /**
+ * Project license file to synchronize with main license defined in
+ * descriptor file.
+ *
+ * @parameter expression="${license.licenceFile}" default-value="${basedir}/LICENSE.txt"
+ * @required
+ * @since 2.1
+ */
+ protected File licenseFile;
+
+ /**
+ * The directory where to generate license resources.
+ * <p/>
+ * <b>Note:</b> This option is not available for {@code pom} module types.
+ *
+ * @parameter expression="${license.outputDirectory}" default-value="target/generated-sources/license"
+ * @since 2.1
+ */
+ protected File outputDirectory;
+
+ /**
+ * A flag to copy the main license file in a bundled place.
+ * <p/>
+ * This is usefull for final application to have a none confusing location
+ * to seek for the application license.
+ * <p/>
+ * If Sets to {@code true}, will copy the license file to the
+ * {@link #bundleLicensePath} to {@link #outputDirectory}.
+ * <p/>
+ * <b>Note:</b> This option is not available for {@code pom} module types.
+ *
+ * @parameter expression="${license.generateBundle}" default-value="false"
+ * @since 2.1
+ */
+ protected boolean generateBundle;
+
+ /**
+ * The path of the bundled license file to produce when
+ * {@link #generateBundle} is on.
+ * <p/>
+ * <b>Note:</b> This option is not available for {@code pom} module types.
+ *
+ * @parameter expression="${license.bundleLicensePath}" default-value="META-INF/${project.artifactId}-LICENSE.txt"
+ * @since 2.1
+ */
+ protected String bundleLicensePath;
+
+ /**
+ * A flag to force to generate project license file even if it is up-to-date.
+ *
+ * @parameter expression="${license.force}" default-value="false"
+ * @since 1.0.0
+ */
+ protected boolean force;
+
+ /**
+ * A flag to skip the goal.
+ *
+ * @parameter expression="${license.skipUpdateProjectLicense}" default-value="false"
+ * @since 2.1
+ */
+ protected boolean skipUpdateProjectLicense;
+
+ /** flag to known if */
+ protected boolean doGenerate;
+
+ @Override
+ protected void init() throws Exception {
+
+ if (isSkip()) {
+ return;
+ }
+
+ super.init();
+
+ // must generate if file does not exist or pom never thant license file
+ File licenseFile = getLicenseFile();
+ if (licenseFile != null) {
+ setDoGenerate(isForce() || !isFileNewerThanPomFile(licenseFile));
+ }
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+
+ License mainLicense = getMainLicense();
+
+ File target = getLicenseFile();
+
+ if (isDoGenerate()) {
+
+ getLog().info("Will create or update license file [" +
+ mainLicense.getName() + "] to " + target);
+ if (isVerbose()) {
+ getLog().info("detail of license :\n" + mainLicense);
+ }
+
+ if (target.exists() && isKeepBackup()) {
+ if (isVerbose()) {
+ getLog().info("backup " + target);
+ }
+ // copy it to backup file
+ backupFile(target);
+ }
+ }
+
+ // obtain license content
+ String licenseContent = mainLicense.getLicenseContent(getEncoding());
+
+ if (isDoGenerate()) {
+
+ // writes it root main license file
+ writeFile(target, licenseContent, getEncoding());
+ }
+
+ if (hasClassPath()) {
+
+ // copy LICENSE.txt to the resource directory (to be include in
+ // class-path)
+ File resourceTarget = new File(getOutputDirectory(), target.getName());
+
+ copyFile(getLicenseFile(), resourceTarget);
+
+ if (isGenerateBundle()) {
+
+ // creates the bundled license file
+ File bundleTarget = PluginHelper.getFile(
+ getOutputDirectory(),
+ getBundleLicensePath()
+ );
+ copyFile(target, bundleTarget);
+ }
+
+ // add resources directory as project resources basedir
+ addResourceDir(getOutputDirectory(), "**/*.txt");
+ }
+ }
+
+ public File getLicenseFile() {
+ return licenseFile;
+ }
+
+ public boolean isGenerateBundle() {
+ return generateBundle;
+ }
+
+ public File getOutputDirectory() {
+ return outputDirectory;
+ }
+
+ public String getBundleLicensePath() {
+ return bundleLicensePath;
+ }
+
+ public boolean isDoGenerate() {
+ return doGenerate;
+ }
+
+ public boolean isForce() {
+ return force;
+ }
+
+ @Override
+ public boolean isSkip() {
+ return skipUpdateProjectLicense;
+ }
+
+ public void setLicenseFile(File licenseFile) {
+ this.licenseFile = licenseFile;
+ }
+
+ public void setGenerateBundle(boolean generateBundle) {
+ this.generateBundle = generateBundle;
+ }
+
+ public void setOutputDirectory(File outputDirectory) {
+ this.outputDirectory = outputDirectory;
+ }
+
+ public void setBundleLicensePath(String bundleLicensePath) {
+ this.bundleLicensePath = bundleLicensePath;
+ }
+
+ public void setDoGenerate(boolean doGenerate) {
+ this.doGenerate = doGenerate;
+ }
+
+ @Override
+ public void setSkip(boolean skipUpdateProjectLicense) {
+ this.skipUpdateProjectLicense = skipUpdateProjectLicense;
+ }
+
+ public void setForce(boolean force) {
+ this.force = force;
+ }
+}
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header;
/**
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header;
import org.apache.commons.logging.Log;
@@ -98,4 +97,4 @@
detectHeader = false;
state = State.SEARCH_HEADER;
}
-}
\ No newline at end of file
+}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header;
import org.nuiton.license.plugin.header.transformer.FileHeaderTransformer;
@@ -106,7 +105,7 @@
}
return fullHeaderContent;
}
-
+
// public FileHeader getHeader() {
// return header;
// }
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/AptLicenseHeaderGeneratorImpl.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.generator;
import org.nuiton.license.plugin.header.FileHeader;
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/HeaderGenerator.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.generator;
import org.nuiton.license.plugin.header.FileHeader;
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/JavaLicenseHeaderGeneratorImpl.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.generator;
import org.nuiton.license.plugin.header.FileHeader;
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/LicenseHeaderGenerator.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.generator;
import org.nuiton.license.plugin.header.FileHeader;
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/PropertiesLicenseHeaderGeneratorImpl.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.generator;
import org.nuiton.license.plugin.header.FileHeader;
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/generator/XmlLicenseHeaderGeneratorImpl.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.generator;
import org.nuiton.license.plugin.header.FileHeader;
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.transformer;
import org.nuiton.license.plugin.header.FileHeader;
@@ -55,10 +54,6 @@
/** comment line prefix (to add for header content) */
protected String commentLinePrefix;
- protected AbstractFileHeaderTransformer() {
-
- }
-
protected AbstractFileHeaderTransformer(String name,
String description,
String commentStartTag,
@@ -71,14 +66,6 @@
this.commentLinePrefix = commentLinePrefix;
}
- protected AbstractFileHeaderTransformer(String commentStartTag,
- String commentEndTag,
- String commentLinePrefix) {
- this.commentStartTag = commentStartTag;
- this.commentEndTag = commentEndTag;
- this.commentLinePrefix = commentLinePrefix;
- }
-
@Override
public String getName() {
return name;
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.transformer;
/**
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.transformer;
import org.nuiton.license.plugin.header.FileHeader;
@@ -29,13 +28,13 @@
String ROLE_NAME = FileHeaderTransformer.class.getName();
/** default section delimiter */
- String DEFAULT_SECTION_DELIMITER = "%%";
+ String DEFAULT_SECTION_DELIMITER = "%" + "%";
/** default process start tag */
- String DEFAULT_PROCESS_START_TAG = "#%L";
+ String DEFAULT_PROCESS_START_TAG = "#" + "%" + "L";
/** default process end tag */
- String DEFAULT_PROCESS_END_TAG = "#L%";
+ String DEFAULT_PROCESS_END_TAG = "#" + "L" + "%";
char LINE_SEPARATOR = '\n';
@@ -78,49 +77,19 @@
*/
String getSectionDelimiter();
+ /** @return the start tag of a comment */
String getCommentStartTag();
+ /** @return the end tag of a comment */
String getCommentEndTag();
+ /** @return the line prefix of every line insed the comment */
String getCommentLinePrefix();
- void setName(String name);
-
- void setDescription(String description);
-
/**
- * Sets the header section delimiter.
- * <p/>
- * By default, will use the {@link #DEFAULT_SECTION_DELIMITER}.
- *
- * @param headerSectionDelimiter the new delimiter
- */
- void setSectionDelimiter(String headerSectionDelimiter);
-
- /**
- * Changes the process start tag.
- *
- * @param tag the new start tag
- */
- void setProcessStartTag(String tag);
-
- /**
- * Changes the process end tag.
- *
- * @param tag the new endtag
- */
- void setProcessEndTag(String tag);
-
- void setCommentStartTag(String commentStartTag);
-
- void setCommentEndTag(String commentEndTag);
-
- void setCommentLinePrefix(String commentLinePrefix);
-
- /**
* Box the given {@code header} in a comment.
*
- * @param header the header content WITHOUT any comment boxing
+ * @param header the header content WITHOUT any comment boxing
* @param withTags flag to add start and end comment tags.
* @return the header content WITH comment boxing
*/
@@ -170,4 +139,62 @@
* @return the UNBOXED header content
*/
String toString(FileHeader model);
+
+ /**
+ * Changes the name of the transformer.
+ *
+ * @param name the new name of the transformer
+ */
+ void setName(String name);
+
+ /**
+ * Chages the description of the transformer.
+ *
+ * @param description the new description of the transformer
+ */
+ void setDescription(String description);
+
+ /**
+ * Sets the header section delimiter.
+ * <p/>
+ * By default, will use the {@link #DEFAULT_SECTION_DELIMITER}.
+ *
+ * @param headerSectionDelimiter the new delimiter
+ */
+ void setSectionDelimiter(String headerSectionDelimiter);
+
+ /**
+ * Changes the process start tag.
+ *
+ * @param tag the new start tag
+ */
+ void setProcessStartTag(String tag);
+
+ /**
+ * Changes the process end tag.
+ *
+ * @param tag the new endtag
+ */
+ void setProcessEndTag(String tag);
+
+ /**
+ * Changes the comment start tag.
+ *
+ * @param commentStartTag the new comment start tag
+ */
+ void setCommentStartTag(String commentStartTag);
+
+ /**
+ * Changes the comment end tag.
+ *
+ * @param commentEndTag the new comment end tag
+ */
+ void setCommentEndTag(String commentEndTag);
+
+ /**
+ * Changes the comment prefix line.
+ *
+ * @param commentLinePrefix the new comment prefix line
+ */
+ void setCommentLinePrefix(String commentLinePrefix);
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.transformer;
/**
@@ -28,4 +27,4 @@
COMMENT_LINE_PREFIX
);
}
-}
\ No newline at end of file
+}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.transformer;
/**
@@ -28,4 +27,4 @@
COMMENT_LINE_PREFIX
);
}
-}
\ No newline at end of file
+}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -13,11 +13,11 @@
public static final String DESCRIPTION = "header transformer with rst comment style";
- public static final String COMMENT_LINE_PREFIX = " ";
+ public static final String COMMENT_LINE_PREFIX = ".. ";
public static final String COMMENT_START_TAG = ".. ";
- public static final String COMMENT_END_TAG = "";
+ public static final String COMMENT_END_TAG = ".. ";
public RstFileHeaderTransformer() {
super(NAME,
@@ -27,4 +27,4 @@
COMMENT_LINE_PREFIX
);
}
-}
\ No newline at end of file
+}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.transformer;
/**
@@ -28,4 +27,4 @@
COMMENT_LINE_PREFIX
);
}
-}
\ No newline at end of file
+}
Modified: trunk/src/main/java/org/nuiton/license/plugin/model/License.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/License.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/License.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.model;
import org.apache.commons.lang.builder.ToStringBuilder;
Modified: trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.model;
import org.apache.commons.logging.Log;
Modified: trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.model;
import org.apache.commons.logging.Log;
Modified: trunk/src/main/mdo/descriptor.mdo
===================================================================
--- trunk/src/main/mdo/descriptor.mdo 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/main/mdo/descriptor.mdo 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,5 +1,30 @@
<?xml version="1.0"?>
+<!--
+ #%L
+ Maven License Plugin
+ $Author$
+ $LastChangedDate$
+ $LastChangedRevision$
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
<model xsd.namespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
xsd.targetNamespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0">
Added: trunk/src/site/rst/actions.rst
===================================================================
--- trunk/src/site/rst/actions.rst (rev 0)
+++ trunk/src/site/rst/actions.rst 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,57 @@
+========
+Actions!
+========
+
+
+:Author: Tony Chemit <chemit(a)codelutin.com>
+:Abstract: Describes action goals
+
+.. contents::
+ :depth: 2
+
+.. #%L
+.. Maven License Plugin
+..
+.. $Author: tchemit $
+.. $LastChangedDate$
+.. $LastChangedRevision$
+.. $Id$
+.. $HeadURL$
+.. %%
+.. Copyright (C) 2008 - 2010 CodeLutin
+.. %%
+.. This program is free software: you can redistribute it and/or modify
+.. it under the terms of the GNU Lesser General Public License as
+.. published by the Free Software Foundation, either version 3 of the
+.. License, or (at your option) any later version.
+..
+.. This program is distributed in the hope that it will be useful,
+.. but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. GNU General Lesser Public License for more details.
+..
+.. You should have received a copy of the GNU General Lesser Public
+.. License along with this program. If not, see
+.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. #L%
+
+Content
+-------
+
+This page describes action goals which interacts with your project source files.
+
+The plugin has the following action goals:
+
+ * `update-project-license`_ adds or updates license project file (since 2.1).
+
+ * `update-license`_ adds or updates license header on some files (since 2.1).
+
+ * `add-third-party`_ creates the THIRD-PARTY.txt in the build.
+
+
+.. _update-project-license: update-project-license-mojo.html
+
+.. _update-license: update-license-mojo.html
+
+.. _add-third-party: add-third-party-mojo.html
+
Property changes on: trunk/src/site/rst/actions.rst
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/site/rst/deprecated-mojos.rst
===================================================================
--- trunk/src/site/rst/deprecated-mojos.rst (rev 0)
+++ trunk/src/site/rst/deprecated-mojos.rst 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,53 @@
+================
+Deprecated mojos
+================
+
+
+:Author: Tony Chemit <chemit(a)codelutin.com>
+:Abstract: Describes deprecated mojos since 2.1
+
+.. contents::
+ :depth: 2
+
+.. #%L
+.. Maven License Plugin
+..
+.. $Author: tchemit $
+.. $LastChangedDate$
+.. $LastChangedRevision$
+.. $Id$
+.. $HeadURL$
+.. %%
+.. Copyright (C) 2008 - 2010 CodeLutin
+.. %%
+.. This program is free software: you can redistribute it and/or modify
+.. it under the terms of the GNU Lesser General Public License as
+.. published by the Free Software Foundation, either version 3 of the
+.. License, or (at your option) any later version.
+..
+.. This program is distributed in the hope that it will be useful,
+.. but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. GNU General Lesser Public License for more details.
+..
+.. You should have received a copy of the GNU General Lesser Public
+.. License along with this program. If not, see
+.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. #L%
+
+Content
+-------
+
+This page describes deprectaed mojos since version **2.1**.
+
+The plugin has the following deprecated goals:
+
+ * `add-license`_ add (and creates it if not found) the LICENSE.txt in the build
+ * `update-header`_ add or update license header on some files
+ * `generator-list`_ display list of available generators
+
+.. _add-license: add-license-mojo.html
+
+.. _update-header: update-header-mojo.html
+
+.. _generator-list: generator-list-mojo.html
Property changes on: trunk/src/site/rst/deprecated-mojos.rst
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/site/rst/descriptor.rst
===================================================================
--- trunk/src/site/rst/descriptor.rst 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/site/rst/descriptor.rst 2010-04-10 15:37:33 UTC (rev 1733)
@@ -10,6 +10,32 @@
:start: 1
:depth: 2
+.. #%L
+.. Maven License Plugin
+..
+.. $Author$
+.. $LastChangedDate$
+.. $LastChangedRevision$
+.. $Id$
+.. $HeadURL$
+.. %%
+.. Copyright (C) 2008 - 2010 CodeLutin
+.. %%
+.. This program is free software: you can redistribute it and/or modify
+.. it under the terms of the GNU Lesser General Public License as
+.. published by the Free Software Foundation, either version 3 of the
+.. License, or (at your option) any later version.
+..
+.. This program is distributed in the hope that it will be useful,
+.. but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. GNU General Lesser Public License for more details.
+..
+.. You should have received a copy of the GNU General Lesser Public
+.. License along with this program. If not, see
+.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. #L%
+
Abstract
========
@@ -18,7 +44,7 @@
The license file descriptor file aims to enumerate all files to include in
license process per type and license.
-This new format is used in goal `update-license`_.
+This new format is used in goal `update-license`_ and `update-project-license`_.
TODO-TC-20100409 Do this documentation
@@ -28,7 +54,7 @@
This file is ruled by a `xsd file`_.
Example
--------
+=======
The next example applies a gpl v3 license on all java files in **src/main/java**.
@@ -56,6 +82,8 @@
.. _update-license: update-license-mojo.html
+.. _update-project-license: update-project-license-mojo.html
+
.. _comment-style-list: comment-style-list-mojo.html
.. _xsd file: licenseProject-1.0.0.xsd
\ No newline at end of file
Added: trunk/src/site/rst/get-informations.rst
===================================================================
--- trunk/src/site/rst/get-informations.rst (rev 0)
+++ trunk/src/site/rst/get-informations.rst 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,54 @@
+=================
+Get informations!
+=================
+
+:Author: Tony Chemit <chemit(a)codelutin.com>
+:Abstract: Describes information goals
+
+.. contents::
+ :depth: 2
+
+.. #%L
+.. Maven License Plugin
+..
+.. $Author: tchemit $
+.. $LastChangedDate$
+.. $LastChangedRevision$
+.. $Id$
+.. $HeadURL$
+.. %%
+.. Copyright (C) 2008 - 2010 CodeLutin
+.. %%
+.. This program is free software: you can redistribute it and/or modify
+.. it under the terms of the GNU Lesser General Public License as
+.. published by the Free Software Foundation, either version 3 of the
+.. License, or (at your option) any later version.
+..
+.. This program is distributed in the hope that it will be useful,
+.. but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. GNU General Lesser Public License for more details.
+..
+.. You should have received a copy of the GNU General Lesser Public
+.. License along with this program. If not, see
+.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. #L%
+
+Content
+-------
+
+This page describes information goals which display in console some helpfull
+informations to build your license project descriptor file.
+
+The plugin has the following information goals:
+
+ * `comment-style-list`_ display list of available comment style header (since 2.1).
+ * `license-list`_ display list of available licenses.
+ * `help`_ display help about the plugin (goals, usage).
+
+
+.. _comment-style-list: comment-style-list-mojo.html
+
+.. _license-list: license-list-mojo.html
+
+.. _help: help-mojo.html
Property changes on: trunk/src/site/rst/get-informations.rst
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/site/rst/header.rst
===================================================================
--- trunk/src/site/rst/header.rst 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/site/rst/header.rst 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,7 +1,6 @@
License Header
~~~~~~~~~~~~~~
-
:Author: Tony Chemit <chemit(a)codelutin.com>
.. contents::
@@ -11,6 +10,32 @@
:start: 1
:depth: 2
+.. #%L
+.. Maven License Plugin
+..
+.. $Author$
+.. $LastChangedDate$
+.. $LastChangedRevision$
+.. $Id$
+.. $HeadURL$
+.. %%
+.. Copyright (C) 2008 - 2010 CodeLutin
+.. %%
+.. This program is free software: you can redistribute it and/or modify
+.. it under the terms of the GNU Lesser General Public License as
+.. published by the Free Software Foundation, either version 3 of the
+.. License, or (at your option) any later version.
+..
+.. This program is distributed in the hope that it will be useful,
+.. but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. GNU General Lesser Public License for more details.
+..
+.. You should have received a copy of the GNU General Lesser Public
+.. License along with this program. If not, see
+.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. #L%
+
Abstract
========
@@ -28,13 +53,13 @@
::
- (1) #%L
+ (1) #\%\L
(2) Project description
(3) --
(4) Copyright (C) 2010 your organization
(5) --
(6) License content
- (7) #L%
+ (7) \#\L\%
* (1) the start process tag used to detect begin of header (NEVER suppress it).
* (2) Project description section
@@ -69,45 +94,52 @@
In a file, we must box the file header in a comment. In the descriptor file
you can customize it by choosing a headerType.
-Available comment type
-======================
+Available comment styles
+========================
-Here is the available comment types.
+Here is the available comment styles.
Using the goal `comment-style-list`_ you can find all of them.
java style
----------
-/*
- * HEADER
- */
+::
+ /*
+ * HEADER
+ */
xml style
---------
-<!--
- HEADER
--->
+::
+ <!--
+ HEADER
+ -->
properties style
----------------
-######
-# HEADER
-######
+::
+ ######
+ # HEADER
+ ######
apt style
---------
-~~~~~~
-~~ HEADER
-~~~~~~
+::
+ ~~~~~~
+ ~~ HEADER
+ ~~~~~~
rst style
---------
-TODO-TC20100409 Add rst implementation
+::
+ ..
+ .. HEADER
+ ..
Ignore a header
===============
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/site/rst/index.rst 2010-04-10 15:37:33 UTC (rev 1733)
@@ -10,12 +10,41 @@
:start: 1
:depth: 2
+.. #%L
+.. Maven License Plugin
+..
+.. $Author$
+.. $LastChangedDate$
+.. $LastChangedRevision$
+.. $Id$
+.. $HeadURL$
+.. %%
+.. Copyright (C) 2008 - 2010 CodeLutin
+.. %%
+.. This program is free software: you can redistribute it and/or modify
+.. it under the terms of the GNU Lesser General Public License as
+.. published by the Free Software Foundation, either version 3 of the
+.. License, or (at your option) any later version.
+..
+.. This program is distributed in the hope that it will be useful,
+.. but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. GNU General Lesser Public License for more details.
+..
+.. You should have received a copy of the GNU General Lesser Public
+.. License along with this program. If not, see
+.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. #L%
+
Maven license Plugin
====================
-The Maven License Plugin is used to add or update the header (with license) on
-files.
+The Maven License Plugin is used to deal with license stuff on a maven project.
+.. NOTE::
+ The process tags are separated by space otherwise plugin can NOT update header of this file!
+
+
License header
~~~~~~~~~~~~~~
@@ -25,7 +54,7 @@
::
- #%L Content #L%
+ # % L Content # L %
The header is composed of two parts :
@@ -38,7 +67,7 @@
::
/*
- * #%L
+ * # % L
* Plugin maven de changement de license
* --
* Copyright (C) 2008 - 2009 CodeLutin
@@ -56,7 +85,7 @@
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
+ * # L %
*/
Goals Overview
@@ -64,20 +93,24 @@
The plugin has the following goals:
- * `license add-license`_ add (and creates it if not found) the LICENSE.txt in the build.
+ * `update-project-license`_ adds or updates license project file (since 2.1).
- * `license add-third-party`_ creates the THIRD-PARTY.txt in the build.
+ * `update-license`_ adds or updates license header on some files (since 2.1).
- * `license generator-list`_ display list of available generators.
+ * `add-third-party`_ creates the THIRD-PARTY.txt in the build.
- * `license help`_ display help about the plugin (goals, usage).
+ * `comment-style-list`_ display list of available comment style header (since 2.1).
- * `license license-list`_ display list of available license.
+ * `license-list`_ display list of available licenses.
- * `license update-license`_ add or update license header on some files (new versions).
+ * `help`_ display help about the plugin (goals, usage).
- * `license update-header`_ add or update license header on some files (deprecated).
+ * `add-license`_ add (and creates it if not found) the LICENSE.txt in the build (deprecated since 2.1).
+ * `update-header`_ add or update license header on some files (deprecated since 2.1).
+
+ * `generator-list`_ display list of available generators (deprecated since 2.1).
+
Usage
~~~~~
@@ -88,16 +121,22 @@
to be done.
-.. _license add-license: add-license-mojo.html
+.. _update-project-license: update-project-license-mojo.html
-.. _license add-third-party: add-third-party-mojo.html
+.. _update-license: update-license-mojo.html
-.. _license update-header: update-header-mojo.html
+.. _comment-style-list: comment-style-list-mojo.html
-.. _license generator-list: generator-list-mojo.html
+.. _add-license: add-license-mojo.html
-.. _license license-list: license-list-mojo.html
+.. _add-third-party: add-third-party-mojo.html
-.. _license help: help-mojo.html
+.. _update-header: update-header-mojo.html
+.. _generator-list: generator-list-mojo.html
+
+.. _license-list: license-list-mojo.html
+
+.. _help: help-mojo.html
+
.. _usage: usage.html
Modified: trunk/src/site/rst/usage.rst
===================================================================
--- trunk/src/site/rst/usage.rst 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/site/rst/usage.rst 2010-04-10 15:37:33 UTC (rev 1733)
@@ -10,42 +10,68 @@
:start: 1
:depth: 2
+..
+.. #%L
+.. Maven License Plugin
+..
+.. $Author$
+.. $LastChangedDate$
+.. $LastChangedRevision$
+.. $Id$
+.. $HeadURL$
+.. %%
+.. Copyright (C) 2008 - 2010 CodeLutin
+.. %%
+.. This program is free software: you can redistribute it and/or modify
+.. it under the terms of the GNU Lesser General Public License as
+.. published by the Free Software Foundation, either version 3 of the
+.. License, or (at your option) any later version.
+..
+.. This program is distributed in the hope that it will be useful,
+.. but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. GNU General Lesser Public License for more details.
+..
+.. You should have received a copy of the GNU General Lesser Public
+.. License along with this program. If not, see
+.. <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. #L%
+..
-add-license goal
-================
+Actions
+=======
+update-project-license goal
+___________________________
+
This goal creates or updates the LICENSE.txt file and add it in build.
-for full detail see `add-license`_ detail page.
+It can also generate a bundle License file to avoid name collision in a final
+application.
-add-third-party goal
-====================
+for full detail see `update-project-license`_ detail page.
-This goal build the THIRD-PARTY.txt file and add it in build.
+update-license goal
+___________________
-for full detail see `add-third-party`_ detail page.
+This goal adds or updates the license header on some files using a xml
+descriptor file to describe all files to include in license process for a whole
+module.
-generator-list goal
-===================
+for full detail see `update-license`_ detail page.
-This goal display of available header generators.
+add-third-party goal
+____________________
-Use it directly (and only) from commandline :
+This goal build the THIRD-PARTY.txt file and add it in build.
-::
+for full detail see `add-third-party`_ detail page.
- mvn license:generator-list
+Get informations
+================
-To display an example of each generator, use the *detail* parameter :
-
-::
-
- mvn license:generator-list -Ddetail
-
-for full detail see `generator-list`_ detail page.
-
license-list goal
-=================
+_________________
This goal display of available licenses.
@@ -63,269 +89,107 @@
for full detail see `license-list`_ detail page.
-update-header goal
-==================
+comment-style-list goal
+_______________________
-**This goal is deprectaed since v 2.1**
+This goal display of available comment style to box file header.
-Prefer use now the **update-license** goal.
+Use it directly (and only) from commandline :
-This goal adds or updates the license header on some files.
+::
-for full detail see `update-header`_ detail page.
+ mvn license:comment-style-list
-update-license goal
-===================
+To display the example, use the *detail* parameter :
-This goal adds or updates the license header on some files using a xml
-descriptor file to describe all files to include in license process for a whole
-module.
-
-for full detail see `update-license`_ detail page.
-
-How does it work ?
-~~~~~~~~~~~~~~~~~~
-
-TODO-TC20100409 This is correct since 2.1 (redo a complete doc before 2.2)
-
-The plugin is looking in the included files for the text between the tags :
-
::
- *##% My Header ##%*
+ mvn license:comment-style-list -Ddetail
-If the pattern is not found, it will add a license header, otherwise it will
-update the content of the text between tags (here *My MyHeader*).
+for full detail see `comment-style-list`_ detail page.
-The plugin will seek in all projets sources roots (and test sources roots).
+help goal
+_________
-Note : to detect the license header we use the `nuiton-processor`_ library.
-Update java files
-~~~~~~~~~~~~~~~~~
+This goal display the help of the plugin (available goals).
-The usual files to use such license header are java sources, that's why it is
-configure to do this task and should ask you the minimum config
+Use it directly (and only) from commandline :
::
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <version>XXX</version>
- <configuration>
- <licenseName>lgpl_v3</licenseName>
- </configuration>
- </plugin>
+ mvn license:help
-will add or update for all java source files of the module (and java test files).
+To display verbose help :
-The command can be launch on the commandline :
-
::
- mvn license:update-header -Dlicense.licenseName=lgpl_v3
+ mvn license:help -Ddetail
-It is possible to use it with other files... (see next)
+for full detail see `help`_ detail page.
-Construct the license header
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Deprecated goals since 2.1
+==========================
-We explain here how to build your own license header.
+Some has been deprecated since we used a unified license project descriptor.
-The licenseName property
-************************
+add-license goal
+________________
-The *licenseName* property indicates which license header to use in the
-file header.
+**This goal is deprectaed since v 2.1**
-See the goal license:license-list.
+This goal creates or updates the LICENSE.txt file and add it in build.
-The generatorName property
-**************************
+for full detail see `add-license`_ detail page.
-The *generatorName* property allows you to change the type of header to add or
-update. At the moment there is two kinds of generator :
+update-header goal
+__________________
- * *license-java* generator, which box the license header in a java comment style
- * *license-xml* generator, which box the license header in a xml comment style
- * *license-properties* generator, which box the license header in a properties comment style (dashed)
+**This goal is deprectaed since v 2.1**
-See the goal license:generator-list.
+Prefer use now the **update-license** goal.
-Example of java license header :
+This goal adds or updates the license header on some files.
-::
+for full detail see `update-header`_ detail page.
- /*
- * *##%
- * Plugin maven de changement de license
- * Copyright (C) 2008 - 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * ##%*
- */
+generator-list goal
+___________________
-Example of xml license header :
+**This goal is deprectaed since v 2.1**
-::
+This goal display of available header generators.
- <!--
- *##%
- Plugin maven de changement de license
- Copyright (C) 2008 - 2009 CodeLutin
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Lesser Public License for more details.
-
- You should have received a copy of the GNU General Lesser Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/lgpl-3.0.html>.
- ##%*
- -->
+Use it directly (and only) from commandline :
-Example of properties license header :
-
::
- ###############################################################################
- # *##%
- # Plugin maven de changement de license
- # Copyright (C) 2008 - 2009 CodeLutin
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU Lesser General Public License as
- # published by the Free Software Foundation, either version 3 of the
- # License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Lesser Public License for more details.
- #
- # You should have received a copy of the GNU General Lesser Public
- # License along with this program. If not, see
- # <http://www.gnu.org/licenses/lgpl-3.0.html>.
- # ##%*
- ###############################################################################
+ mvn license:generator-list
-The template property
-*********************
+To display an example of each generator, use the *detail* parameter :
-The velocity template to use to generate the full license header text.
-
-The template can be a class-path resource, or a file.
-
-By default, the is a template offers by the plugin */license/default.vm*
-
::
- $projectName
- Copyright (C) $inceptionYear $organizationName
+ mvn license:generator-list -Ddetail
- $licenseContent
+for full detail see `generator-list`_ detail page.
-If you want to write your own template, here is the list of available properties
-in the velocity template :
+.. _update-project-license: update-project-license-mojo.html
- * *projectName*
- * *inceptionYear*
- * *organizationName*
- * *licenseContent*
+.. _update-license: update-license-mojo.html
-And also, all entries of property *templateParameters*.
+.. _add-third-party: add-third-party-mojo.html
-After been generated, all lines of the content is prefix with generator linePrefix.
+.. _license-list: license-list-mojo.html
-Other properties
-****************
+.. _comment-style-list: comment-style-list-mojo.html
-There is some other properties used to build the header :
+.. _help: help-mojo.html
- * *projectName*
- * *inceptionYear*
- * *organizationName*
- * *templateParameters*
+.. _nuiton-processor : http://maven-site.nuiton.org/processor/index.html
-See the goal `detail`_ page to have them all.
-
-
-.. _detail: update-header-mojo.html
-
-
-Files to treate
-~~~~~~~~~~~~~~~
-
-To change the set of files to treate, use the *includes* and *excludes*
-properties.
-
-By default, the mojo will scan in all source roots and test source roots
-
-::
-
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <version>XXX</version>
- <configuration>
- <includes>**/*.xml,**/*.html</includes>
- <excludes>**/site.xml</excludes>
- </configuration>
- </plugin>
-
-
-help goal
-=========
-
-
-This goal display the help of the plugin (available goals).
-
-Use it directly (and only) from commandline :
-
-::
-
- mvn license:help
-
-To display verbose help :
-
-::
-
- mvn license:help -Ddetail
-
-for full detail see `help`_ detail page.
-
-
.. _add-license: add-license-mojo.html
-.. _add-third-party: add-third-party-mojo.html
-
.. _update-header: update-header-mojo.html
-.. _update-license: update-license-mojo.html
-
.. _generator-list: generator-list-mojo.html
-
-.. _license-list: license-list-mojo.html
-
-.. _help: help-mojo.html
-
-.. _nuiton-processor : http://maven-site.nuiton.org/processor/index.html
Modified: trunk/src/site/site_en.xml
===================================================================
--- trunk/src/site/site_en.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/site/site_en.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,24 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- *##%
+ #%L
Maven License Plugin
+ $Author$
+ $LastChangedDate$
+ $LastChangedRevision$
+ $Id$
+ $HeadURL$
+ %%
Copyright (C) 2008 - 2010 CodeLutin
-
+ %%
This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation, either version 3 of the
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Lesser Public License for more details.
-
- You should have received a copy of the GNU General Lesser Public
+
+ You should have received a copy of the GNU General Lesser Public
License along with this program. If not, see
<http://www.gnu.org/licenses/lgpl-3.0.html>.
- ##%*
--->
+ #L%
+ -->
<project name="${project.name}">
<bannerLeft>
@@ -48,14 +54,22 @@
<item name="Introduction" href="index.html"/>
<item name="File header model" href="header.html"/>
<item name="License project descriptor" href="descriptor.html"/>
- <item name="Usage" href="usage.html"/>
- <item name="Goals" href="plugin-info.html">
- <item name="add-license" href="add-license-mojo.html"/>
- <item name="add-third-party" href="add-third-party-mojo.html"/>
- <item name="update-header" href="update-header-mojo.html"/>
- <item name="generator-list" href="generator-list-mojo.html"/>
- <item name="license-list" href="license-list-mojo.html"/>
- <item name="help" href="help-mojo.html"/>
+ <item name="Usage" href="usage.html">
+ <item name="Actions" href="actions.html">
+ <item name="update-project-license" href="update-project-license-mojo.html"/>
+ <item name="update-license" href="update-license-mojo.html"/>
+ <item name="add-third-party" href="add-third-party-mojo.html"/>
+ </item>
+ <item name="Get informations" href="get-informations.html">
+ <item name="license-list" href="license-list-mojo.html"/>
+ <item name="comment-style-list" href="comment-style-list-mojo.html"/>
+ <item name="help" href="help-mojo.html"/>
+ </item>
+ <item name="Deprecated goals" href="deprecated-mojos.html">
+ <item name="add-license" href="add-license-mojo.html"/>
+ <item name="update-header" href="update-header-mojo.html"/>
+ <item name="generator-list" href="generator-list-mojo.html"/>
+ </item>
</item>
</menu>
Modified: trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/java/org/nuiton/license/plugin/AddLicenseFileMojoTest.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.junit.Test;
@@ -11,6 +10,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ * @deprecated since 2.1, will be remove soon.
+ */
+@Deprecated
public class AddLicenseFileMojoTest extends AbstractMojoTest<AddLicenseFileMojo> {
@Override
Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.junit.Test;
@@ -14,7 +13,7 @@
import static org.junit.Assert.assertTrue;
/**
- * @author tchemit <chemit àcodelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 1.0
* @deprecated since 2.1, will be remove soon.
*/
@@ -78,7 +77,7 @@
}
for (String p : mandatoryPatterns) {
- checkPattern(f,content, p, true);
+ checkPattern(f, content, p, true);
}
for (String p : excludePatterns) {
checkPattern(f, content, p, false);
@@ -93,8 +92,8 @@
* @param required
* @param f
* @throws IOException
- * @deprecated since 2.1, prefer use the
- * {@link #checkPattern(File, String, String, boolean)} method instead.
+ * @deprecated since 2.1, prefer use the
+ * {@link #checkPattern(File, String, String, boolean)} method instead.
*/
@Deprecated
protected void checkPattern(String content,
Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin;
import org.junit.Assert;
@@ -15,7 +14,7 @@
* @since 2.1
*/
public class UpdateLicenseMojoTest extends AbstractMojoTest<UpdateLicenseMojo> {
-
+
@Override
protected String getGoalName(String methodName) {
return "update-license";
@@ -89,7 +88,7 @@
// check header
checkPattern(f, content, "Copyright (C) 2000 Codelutin Do not update!", true);
- checkPattern(f, content, " * %%Ignore-License", true);
+ checkPattern(f, content, " * %" + "%Ignore-License", true);
checkPattern(f, content, "yet another license", true);
checkPattern(f, content, "NEVER_FINd_ME!", false);
@@ -100,11 +99,19 @@
// check header (description + copyright) does not changed
checkPattern(f, content, "Copyright (C) 2000 Codelutin Do not update!", true);
- checkPattern(f, content, " * %%Ignore-License", true);
+ checkPattern(f, content, " * %" + "%Ignore-License", true);
checkPattern(f, content, "yet another license", true);
checkPattern(f, content, "NEVER_FINd_ME!", false);
}
+ @Test
+ public void skip() throws Exception {
+
+ UpdateLicenseMojo mojo = getMojo();
+ mojo.execute();
+ Assert.assertTrue(mojo.isSkip());
+ }
+
protected File getMyBeanFile(String testName) {
File f = PluginHelper.getFile(getBasedir(),
"target",
Added: trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java (rev 0)
+++ trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,116 @@
+package org.nuiton.license.plugin;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.nuiton.plugin.AbstractMojoTest;
+import org.nuiton.plugin.PluginHelper;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class UpdateProjectLicenseMojoTest extends AbstractMojoTest<UpdateProjectLicenseMojo> {
+
+ @Override
+ protected String getGoalName(String methodName) {
+ return "update-project-license";
+ }
+
+ @Override
+ protected void setUpMojo(UpdateProjectLicenseMojo mojo,
+ File pomFile) throws Exception {
+ super.setUpMojo(mojo, pomFile);
+ if (mojo.isSkip()) {
+ return;
+ }
+ // license is where the pom is
+ File outputDirectory = pomFile.getParentFile();
+ mojo.setOutputDirectory(outputDirectory);
+ mojo.setDescriptor(
+ new File(outputDirectory, mojo.getDescriptor().getName()));
+ if (!outputDirectory.exists()) {
+ if (!outputDirectory.mkdirs()) {
+ throw new IOException(
+ "could not create directory : " + outputDirectory);
+ }
+ }
+ mojo.setLicenseFile(new File(pomFile.getParentFile(),
+ mojo.getLicenseFile().toString())
+ );
+
+ log.info("pom : " +
+ getRelativePathFromBasedir(mojo.getProject().getFile()));
+ log.info("outputDirectory : " +
+ getRelativePathFromBasedir(mojo.getOutputDirectory()));
+ log.info("licenseFile : " +
+ getRelativePathFromBasedir(mojo.getLicenseFile()));
+ }
+
+ @Test
+ public void testOne() throws Exception {
+
+ UpdateProjectLicenseMojo mojo = getMojo();
+
+ File licenseFile = mojo.getLicenseFile();
+ long t0 = licenseFile.lastModified();
+
+ // always assume pom is older than any file
+ // since we can not ensure order of copy test resources
+ PluginHelper.setLastModified(mojo.getProject().getFile(), 0);
+
+ // then executing the mojo, will do NOT change the licence file
+ mojo.execute();
+
+ long t1 = licenseFile.lastModified();
+
+ assertEquals(t0, t1);
+
+ // force to override the license file
+ mojo.setForce(true);
+
+ mojo.execute();
+ t1 = licenseFile.lastModified();
+
+ assertTrue(t1 > t0);
+ }
+
+ @Test
+ public void testTwo() throws Exception {
+
+ UpdateProjectLicenseMojo mojo = getMojo();
+
+ File licenseFile = mojo.getLicenseFile();
+ long t0 = licenseFile.lastModified();
+
+ // always assume pom is older than any file
+ // since we can not ensure order of copy test resources
+ PluginHelper.setLastModified(mojo.getProject().getFile(), 0);
+
+ // then executing the mojo, will do NOT change the licence file
+ mojo.execute();
+
+ long t1 = licenseFile.lastModified();
+
+ assertEquals(t0, t1);
+
+ // force to override the license file
+ mojo.setForce(true);
+
+ mojo.execute();
+ t1 = licenseFile.lastModified();
+
+ assertTrue(t1 > t0);
+ }
+
+
+ @Test
+ public void skip() throws Exception {
+
+ UpdateProjectLicenseMojo mojo = getMojo();
+ mojo.execute();
+ Assert.assertTrue(mojo.isSkip());
+
+ }
+}
\ No newline at end of file
Property changes on: trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.header.transformer;
import org.junit.After;
Modified: trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.model;
import org.junit.Assert;
Modified: trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,4 +1,3 @@
-
package org.nuiton.license.plugin.model;
import org.junit.Assert;
Modified: trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testOne.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testOne.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testOne.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,32 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <groupId>org.nuiton</groupId>
- <artifactId>maven-helper-plugin-testOne</artifactId>
- <version>0</version>
- <modelVersion>4.0.0</modelVersion>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin-testOne</artifactId>
+ <version>0</version>
+ <modelVersion>4.0.0</modelVersion>
- <build>
+ <build>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <configuration>
- <encoding>UTF-8</encoding>
- <licenseName>lgpl_v3</licenseName>
- <licenseFile>licenseOne.txt</licenseFile>
- <!--<outputDirectory>test</outputDirectory>-->
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>add-license</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <licenseName>lgpl_v3</licenseName>
+ <licenseFile>licenseOne.txt</licenseFile>
+ <!--<outputDirectory>test</outputDirectory>-->
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>add-license</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testTwo.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testTwo.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/resources/org/nuiton/license/plugin/addLicenseFileMojoTest/testTwo.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -1,34 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-helper-plugin-testOne</artifactId>
- <version>0</version>
-
- <build>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin-testOne</artifactId>
+ <version>0</version>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <configuration>
- <encoding>UTF-8</encoding>
- <licenseName>lgpl_v3</licenseName>
- <licenseFile>licenseTwo.txt</licenseFile>
- <!--<outputDirectory>test</outputDirectory>-->
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>add-license</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <licenseName>lgpl_v3</licenseName>
+ <licenseFile>licenseTwo.txt</licenseFile>
+ <!--<outputDirectory>test</outputDirectory>-->
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>add-license</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/bug_28.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/bug_28.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/bug_28.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -2,43 +2,45 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin-bug_28</artifactId>
- <version>0</version>
- <modelVersion>4.0.0</modelVersion>
- <name>TestOne</name>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin-bug_28</artifactId>
+ <version>0</version>
+ <modelVersion>4.0.0</modelVersion>
- <build>
+ <name>TestOne</name>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <configuration>
- <projectName>maven-license-plugin-bug_28</projectName>
- <organizationName>CodeLutin</organizationName>
- <inceptionYear>2009</inceptionYear>
- <encoding>UTF-8</encoding>
- <licenseName>lgpl_v3</licenseName>
- <generatorName>license-java</generatorName>
- <template>/license/defaultHeader.vm</template>
- <compileSourceRoots>
- <dir>target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/bug_28</dir>
- </compileSourceRoots>
- <testSourceRoots/>
- <includes>**/*.java2</includes>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>update-header</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <projectName>maven-license-plugin-bug_28</projectName>
+ <organizationName>CodeLutin</organizationName>
+ <inceptionYear>2009</inceptionYear>
+ <encoding>UTF-8</encoding>
+ <licenseName>lgpl_v3</licenseName>
+ <generatorName>license-java</generatorName>
+ <template>/license/defaultHeader.vm</template>
+ <compileSourceRoots>
+ <dir>
+ target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/bug_28
+ </dir>
+ </compileSourceRoots>
+ <testSourceRoots/>
+ <includes>**/*.java2</includes>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-header</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/java.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/java.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/java.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -2,43 +2,45 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin-java</artifactId>
- <version>0</version>
- <modelVersion>4.0.0</modelVersion>
- <name>TestOne</name>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin-java</artifactId>
+ <version>0</version>
+ <modelVersion>4.0.0</modelVersion>
- <build>
+ <name>TestOne</name>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <configuration>
- <projectName>maven-license-plugin-java</projectName>
- <organizationName>CodeLutin</organizationName>
- <inceptionYear>2009</inceptionYear>
- <encoding>UTF-8</encoding>
- <licenseName>lgpl_v3</licenseName>
- <generatorName>license-java</generatorName>
- <template>/license/defaultHeader.vm</template>
- <compileSourceRoots>
- <dir>target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/java</dir>
- </compileSourceRoots>
- <testSourceRoots/>
- <includes>**/*.java2,**/*.css</includes>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>update-header</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <projectName>maven-license-plugin-java</projectName>
+ <organizationName>CodeLutin</organizationName>
+ <inceptionYear>2009</inceptionYear>
+ <encoding>UTF-8</encoding>
+ <licenseName>lgpl_v3</licenseName>
+ <generatorName>license-java</generatorName>
+ <template>/license/defaultHeader.vm</template>
+ <compileSourceRoots>
+ <dir>
+ target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/java
+ </dir>
+ </compileSourceRoots>
+ <testSourceRoots/>
+ <includes>**/*.java2,**/*.css</includes>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-header</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/properties.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/properties.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/properties.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -2,41 +2,43 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin-properties</artifactId>
- <version>0</version>
- <modelVersion>4.0.0</modelVersion>
- <name>TestOne</name>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin-properties</artifactId>
+ <version>0</version>
+ <modelVersion>4.0.0</modelVersion>
- <build>
+ <name>TestOne</name>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <configuration>
- <projectName>maven-license-plugin-properties</projectName>
- <organizationName>CodeLutin</organizationName>
- <inceptionYear>2009</inceptionYear>
- <encoding>UTF-8</encoding>
- <licenseName>lgpl_v3</licenseName>
- <generatorName>license-properties</generatorName>
- <template>/license/defaultHeader.vm</template>
- <compileSourceRoots>target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/properties</compileSourceRoots>
- <testSourceRoots/>
- <includes>**/*.properties,**/*.sh</includes>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>update-header</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <projectName>maven-license-plugin-properties</projectName>
+ <organizationName>CodeLutin</organizationName>
+ <inceptionYear>2009</inceptionYear>
+ <encoding>UTF-8</encoding>
+ <licenseName>lgpl_v3</licenseName>
+ <generatorName>license-properties</generatorName>
+ <template>/license/defaultHeader.vm</template>
+ <compileSourceRoots>
+ target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/properties
+ </compileSourceRoots>
+ <testSourceRoots/>
+ <includes>**/*.properties,**/*.sh</includes>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-header</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/xml.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/xml.xml 2010-04-09 23:52:31 UTC (rev 1732)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateHeaderMojoTest/xml.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -2,43 +2,45 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin-xml</artifactId>
- <version>0</version>
- <modelVersion>4.0.0</modelVersion>
- <name>TestOne</name>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin-xml</artifactId>
+ <version>0</version>
+ <modelVersion>4.0.0</modelVersion>
- <build>
+ <name>TestOne</name>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <configuration>
- <projectName>maven-license-plugin-xml</projectName>
- <organizationName>CodeLutin</organizationName>
- <inceptionYear>2009</inceptionYear>
- <encoding>UTF-8</encoding>
- <licenseName>lgpl_v3</licenseName>
- <generatorName>license-xml</generatorName>
- <template>/license/defaultHeader.vm</template>
- <compileSourceRoots>
- <dir>target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/xml</dir>
- </compileSourceRoots>
- <testSourceRoots/>
- <includes>**/*.xml,**/*.html</includes>
- <verbose>true</verbose>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>update-header</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <projectName>maven-license-plugin-xml</projectName>
+ <organizationName>CodeLutin</organizationName>
+ <inceptionYear>2009</inceptionYear>
+ <encoding>UTF-8</encoding>
+ <licenseName>lgpl_v3</licenseName>
+ <generatorName>license-xml</generatorName>
+ <template>/license/defaultHeader.vm</template>
+ <compileSourceRoots>
+ <dir>
+ target/test-classes/org/nuiton/license/plugin/UpdateHeaderPluginTest/xml
+ </dir>
+ </compileSourceRoots>
+ <testSourceRoots/>
+ <includes>**/*.xml,**/*.html</includes>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-header</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml (rev 0)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <groupId>org.nuiton.license.test</groupId>
+ <artifactId>maven-license-plugin-java</artifactId>
+ <version>0</version>
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>Add License to MyBean</name>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <skipUpdateLicense>true</skipUpdateLicense>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-license</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/skip.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt (rev 0)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1 @@
+dummy license
\ No newline at end of file
Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseOne.txt
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt (rev 0)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1 @@
+dummy license
\ No newline at end of file
Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/licenseTwo.txt
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml (rev 0)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd">
+ <mainLicense>lgpl_v3</mainLicense>
+</project>
Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectOne.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml (rev 0)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd">
+ <mainLicense>gpl_v3</mainLicense>
+</project>
Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/projectTwo.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml (rev 0)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <groupId>org.nuiton.license.test</groupId>
+ <artifactId>maven-license-plugin-update-project-file</artifactId>
+ <version>0</version>
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>Update project License file</name>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <skipUpdateProjectLicense>true</skipUpdateProjectLicense>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-project-license</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/skip.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml (rev 0)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin-testOne</artifactId>
+ <version>0</version>
+ <modelVersion>4.0.0</modelVersion>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <descriptor>${basedir}/projectOne.xml</descriptor>
+ <licenseFile>licenseOne.txt</licenseFile>
+ <!--<outputDirectory>test</outputDirectory>-->
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-project-license</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+</project>
\ No newline at end of file
Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testOne.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml (rev 0)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml 2010-04-10 15:37:33 UTC (rev 1733)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin-testOne</artifactId>
+ <version>0</version>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <descriptor>projectTwo.xml</descriptor>
+ <licenseFile>licenseTwo.txt</licenseFile>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>update-project-license</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+</project>
\ No newline at end of file
Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateProjectLicenseMojoTest/testTwo.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
1
0
r1732 - in trunk/src: main/java/org/nuiton/license/plugin/header/transformer site/rst
by tchemit@users.nuiton.org 09 Apr '10
by tchemit@users.nuiton.org 09 Apr '10
09 Apr '10
Author: tchemit
Date: 2010-04-10 01:52:31 +0200 (Sat, 10 Apr 2010)
New Revision: 1732
Log:
fix transformer extra line + add rst transformer
Added:
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java
Modified:
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java
trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java
trunk/src/site/rst/descriptor.rst
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java 2010-04-09 23:09:12 UTC (rev 1731)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
@@ -16,9 +16,9 @@
public static final String COMMENT_LINE_PREFIX = "~~~ ";
- public static final String COMMENT_START_TAG = "\n";
+ public static final String COMMENT_START_TAG = "";
- public static final String COMMENT_END_TAG = "\n";
+ public static final String COMMENT_END_TAG = "";
public AptFileHeaderTransformer() {
super(NAME,
Added: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java (rev 0)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
@@ -0,0 +1,30 @@
+package org.nuiton.license.plugin.header.transformer;
+
+/**
+ * Implementation of {@link FileHeaderTransformer} for apt format.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @plexus.component role-hint="rst"
+ * @since 2.1
+ */
+public class RstFileHeaderTransformer extends AbstractFileHeaderTransformer {
+
+ public static final String NAME = "rst";
+
+ public static final String DESCRIPTION = "header transformer with rst comment style";
+
+ public static final String COMMENT_LINE_PREFIX = " ";
+
+ public static final String COMMENT_START_TAG = ".. ";
+
+ public static final String COMMENT_END_TAG = "";
+
+ public RstFileHeaderTransformer() {
+ super(NAME,
+ DESCRIPTION,
+ COMMENT_START_TAG,
+ COMMENT_END_TAG,
+ COMMENT_LINE_PREFIX
+ );
+ }
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-09 23:09:12 UTC (rev 1731)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-04-09 23:52:31 UTC (rev 1732)
@@ -14,11 +14,11 @@
public static final String DESCRIPTION = "header transformer with xml comment style";
- public static final String COMMENT_LINE_PREFIX = " ";
+ public static final String COMMENT_LINE_PREFIX = " ";
public static final String COMMENT_START_TAG = "<!--";
- public static final String COMMENT_END_TAG = "-->";
+ public static final String COMMENT_END_TAG = " -->";
public XmlFileHeaderTransformer() {
super(NAME,
Modified: trunk/src/site/rst/descriptor.rst
===================================================================
--- trunk/src/site/rst/descriptor.rst 2010-04-09 23:09:12 UTC (rev 1731)
+++ trunk/src/site/rst/descriptor.rst 2010-04-09 23:52:31 UTC (rev 1732)
@@ -1,7 +1,6 @@
License project descriptor
~~~~~~~~~~~~~~~~~~~~~~~~~~
-
:Author: Tony Chemit <chemit(a)codelutin.com>
.. contents::
1
0