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
November 2010
- 3 participants
- 22 discussions
Author: tchemit
Date: 2010-11-21 15:30:22 +0100 (Sun, 21 Nov 2010)
New Revision: 1891
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1891
Log:
Update mavenpom4redmineAndCentral to 2.4.1.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
+++ trunk/pom.xml 2010-11-21 14:30:22 UTC (rev 1891)
@@ -34,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>2.4</version>
+ <version>2.4.1</version>
</parent>
<artifactId>maven-license-plugin</artifactId>
@@ -375,7 +375,7 @@
<processorVersion>1.0.4</processorVersion>
<!-- helper version -->
- <helperPluginVersion>1.2.9</helperPluginVersion>
+ <helperPluginVersion>1.2.10</helperPluginVersion>
<!-- documentation is in apt format -->
<siteSourcesType>apt</siteSourcesType>
1
0
Author: tchemit
Date: 2010-11-21 14:28:04 +0100 (Sun, 21 Nov 2010)
New Revision: 1890
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1890
Log:
reformat project with maven code convention
Removed:
trunk/src/main/java/org/nuiton/license/plugin/model/descriptor/
Modified:
trunk/pom.xml
trunk/src/it/add-third-party/merge-licenses/verify.groovy
trunk/src/it/add-third-party/no-deps/pom.xml
trunk/src/it/add-third-party/no-deps/verify.groovy
trunk/src/it/add-third-party/no-encoding/pom.xml
trunk/src/it/add-third-party/no-encoding/verify.groovy
trunk/src/it/add-third-party/with-deps/verify.groovy
trunk/src/it/aggregate-add-third-party/verify.groovy
trunk/src/it/ano-812/pom.xml
trunk/src/it/ano-812/verify.groovy
trunk/src/it/ano-816/child1/pom.xml
trunk/src/it/ano-816/verify.groovy
trunk/src/it/ano-947/child1/pom.xml
trunk/src/it/ano-947/child1/src/files/xml/test2.xml
trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean.java
trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
trunk/src/it/ano-947/pom.xml
trunk/src/it/ano-947/verify.groovy
trunk/src/it/evol-818/excluded-included/pom.xml
trunk/src/it/evol-818/excluded-included/verify.groovy
trunk/src/it/evol-818/multimodule-filters/child1/pom.xml
trunk/src/it/evol-818/multimodule-filters/child2/pom.xml
trunk/src/it/evol-818/multimodule-filters/pom.xml
trunk/src/it/evol-818/multimodule-filters/verify.groovy
trunk/src/it/evol-884/update-file-header-specific/src/files/xml/test2.xml
trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean.java
trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
trunk/src/it/evol-884/update-file-header-specific/verify.groovy
trunk/src/it/evol-884/update-file-header/src/files/xml/test2.xml
trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean.java
trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
trunk/src/it/evol-884/update-file-header/verify.groovy
trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java
trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
trunk/src/it/evol-884/update-project-license/verify.groovy
trunk/src/it/evol-952/src/files/xml/test2.xml
trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean.java
trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
trunk/src/it/evol-952/verify.groovy
trunk/src/it/update-file-header/src/files/xml/test2.xml
trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean.java
trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
trunk/src/it/update-file-header/verify.groovy
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/main/java/org/nuiton/license/plugin/AbstractAddThirdPartyMojo.java
trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java
trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseNameMojo.java
trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyMojo.java
trunk/src/main/java/org/nuiton/license/plugin/AggregatorAddThirdPartyMojo.java
trunk/src/main/java/org/nuiton/license/plugin/ArtifactHelper.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/LicenseMap.java
trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.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/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/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/java/org/nuiton/license/plugin/model/package.html
trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd
trunk/src/site/site_en.xml
trunk/src/site/site_fr.xml
trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.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/header/transformer/XmlFileHeaderTransformerTest.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/src/MyBean.java
trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all.xml
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/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/src/MyBean.java
trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java
trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml
trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java
trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -25,7 +25,7 @@
-->
<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>
+ <modelVersion>4.0.0</modelVersion>
<!-- ************************************************************* -->
<!-- *** POM Relationships *************************************** -->
Modified: trunk/src/it/add-third-party/merge-licenses/verify.groovy
===================================================================
--- trunk/src/it/add-third-party/merge-licenses/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/add-third-party/merge-licenses/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,17 +26,17 @@
file = new File(basedir, 'target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
-assert !content.contains( '(Apache License, Version 2.0) JHLabs Image Processing Filters (com.jhlabs:filters:2.0.235 - http://www.jhlabs.com/ip/index.html)' );
-assert content.contains( '(The Apache Software License, Version 2.0) JHLabs Image Processing Filters (com.jhlabs:filters:2.0.235 - http://www.jhlabs.com/ip/index.html)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
+assert !content.contains('(Apache License, Version 2.0) JHLabs Image Processing Filters (com.jhlabs:filters:2.0.235 - http://www.jhlabs.com/ip/index.html)');
+assert content.contains('(The Apache Software License, Version 2.0) JHLabs Image Processing Filters (com.jhlabs:filters:2.0.235 - http://www.jhlabs.com/ip/index.html)');
file = new File(basedir, 'target/generated-sources/license/META-INF/test-add-third-party-merge-license-THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
-assert !content.contains( '(Apache License, Version 2.0) JHLabs Image Processing Filters (com.jhlabs:filters:2.0.235 - http://www.jhlabs.com/ip/index.html)' );
-assert content.contains( '(The Apache Software License, Version 2.0) JHLabs Image Processing Filters (com.jhlabs:filters:2.0.235 - http://www.jhlabs.com/ip/index.html)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
+assert !content.contains('(Apache License, Version 2.0) JHLabs Image Processing Filters (com.jhlabs:filters:2.0.235 - http://www.jhlabs.com/ip/index.html)');
+assert content.contains('(The Apache Software License, Version 2.0) JHLabs Image Processing Filters (com.jhlabs:filters:2.0.235 - http://www.jhlabs.com/ip/index.html)');
return true;
Modified: trunk/src/it/add-third-party/no-deps/pom.xml
===================================================================
--- trunk/src/it/add-third-party/no-deps/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/add-third-party/no-deps/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -49,7 +49,7 @@
<plugin>
<groupId>org.nuiton</groupId>
<artifactId>maven-license-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@pom.version@</version>
</plugin>
</plugins>
</pluginManagement>
Modified: trunk/src/it/add-third-party/no-deps/verify.groovy
===================================================================
--- trunk/src/it/add-third-party/no-deps/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/add-third-party/no-deps/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,11 +26,11 @@
file = new File(basedir, 'target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert content.contains( 'the project has no dependencies.' );
+assert content.contains('the project has no dependencies.');
file = new File(basedir, 'target/generated-sources/license/META-INF/test-add-third-party-no-deps-THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert content.contains( 'the project has no dependencies.' );
+assert content.contains('the project has no dependencies.');
return true;
Modified: trunk/src/it/add-third-party/no-encoding/pom.xml
===================================================================
--- trunk/src/it/add-third-party/no-encoding/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/add-third-party/no-encoding/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -36,7 +36,7 @@
<name>License Test :: add-third-party-no-encoding</name>
- <properties>
+ <properties>
<license.generateBundle>true</license.generateBundle>
<license.verbose>true</license.verbose>
</properties>
Modified: trunk/src/it/add-third-party/no-encoding/verify.groovy
===================================================================
--- trunk/src/it/add-third-party/no-encoding/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/add-third-party/no-encoding/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,19 +26,19 @@
file = new File(basedir, 'target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
file = new File(basedir, 'target/generated-sources/license/META-INF/add-third-party-no-encoding-THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
file = new File(basedir, 'build.log');
assert file.exists();
content = file.text;
-assert content.contains( 'File encoding has not been set, using platform encoding' );
+assert content.contains('File encoding has not been set, using platform encoding');
return true;
Modified: trunk/src/it/add-third-party/with-deps/verify.groovy
===================================================================
--- trunk/src/it/add-third-party/with-deps/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/add-third-party/with-deps/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,13 +26,13 @@
file = new File(basedir, 'target/generated-sources/license/third.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
file = new File(basedir, 'target/generated-sources/license/test/third.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
return true;
Modified: trunk/src/it/aggregate-add-third-party/verify.groovy
===================================================================
--- trunk/src/it/aggregate-add-third-party/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/aggregate-add-third-party/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,43 +26,43 @@
file = new File(basedir, 'target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
file = new File(basedir, 'target/generated-sources/license/META-INF/test-aggregate-add-third-party-THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
file = new File(basedir, 'child1/target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
-assert !content.contains( '(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
+assert !content.contains('(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)');
file = new File(basedir, 'child1/target/generated-sources/license/META-INF/test-aggregate-add-third-party-child1-THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
-assert !content.contains( '(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
+assert !content.contains('(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)');
file = new File(basedir, 'child2/target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)' );
-assert !content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)');
+assert !content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
file = new File(basedir, 'child2/target/generated-sources/license/META-INF/test-aggregate-add-third-party-child2-THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)' );
-assert !content.contains( '(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(Common Public License Version 1.0) JUnit (junit:junit:4.8.1 - http://junit.org)');
+assert !content.contains('(The Apache Software License, Version 2.0) Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging)');
return true;
Modified: trunk/src/it/ano-812/pom.xml
===================================================================
--- trunk/src/it/ano-812/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-812/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -45,7 +45,7 @@
<version>3.2.7</version>
</dependency>
</dependencies>
-
+
<organization>
<name>License Test</name>
</organization>
@@ -53,7 +53,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<license.verbose>true</license.verbose>
- <license.licenseName>lgpl_v3</license.licenseName>
+ <license.licenseName>lgpl_v3</license.licenseName>
</properties>
<build>
Modified: trunk/src/it/ano-812/verify.groovy
===================================================================
--- trunk/src/it/ano-812/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-812/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,7 +26,7 @@
file = new File(basedir, 'target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(Unknown license) wstx-asl (woodstox:wstx-asl:3.2.7 - no url defined)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(Unknown license) wstx-asl (woodstox:wstx-asl:3.2.7 - no url defined)');
return true;
Modified: trunk/src/it/ano-816/child1/pom.xml
===================================================================
--- trunk/src/it/ano-816/child1/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-816/child1/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -42,15 +42,15 @@
<name><!--fake license with no name--></name>
</license>
<license>
- <name> </name>
+ <name></name>
</license>
<license>
- <name> </name>
+ <name></name>
<url><!-- fake license with no name nor url--></url>
</license>
<license>
- <name> </name>
- <url> </url>
+ <name></name>
+ <url></url>
</license>
</licenses>
<name>License Test :: ano-816 - child 1</name>
Modified: trunk/src/it/ano-816/verify.groovy
===================================================================
--- trunk/src/it/ano-816/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-816/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,7 +26,7 @@
file = new File(basedir, 'target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( '(Unknown license) License Test :: ano-816 - child 1 (org.nuiton.license.test:test-it-816-child1:1.0 - no-url/test-it-816-child1)' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('(Unknown license) License Test :: ano-816 - child 1 (org.nuiton.license.test:test-it-816-child1:1.0 - no-url/test-it-816-child1)');
return true;
Modified: trunk/src/it/ano-947/child1/pom.xml
===================================================================
--- trunk/src/it/ano-947/child1/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-947/child1/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -42,15 +42,15 @@
<name><!--fake license with no name--></name>
</license>
<license>
- <name> </name>
+ <name></name>
</license>
<license>
- <name> </name>
+ <name></name>
<url><!-- fake license with no name nor url--></url>
</license>
<license>
- <name> </name>
- <url> </url>
+ <name></name>
+ <url></url>
</license>
</licenses>
<name>License Test :: ano-947 - child 1</name>
Modified: trunk/src/it/ano-947/child1/src/files/xml/test2.xml
===================================================================
--- trunk/src/it/ano-947/child1/src/files/xml/test2.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-947/child1/src/files/xml/test2.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -23,5 +23,5 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<yo/>
\ No newline at end of file
Modified: trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean.java
===================================================================
--- trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
===================================================================
--- trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean2 {
+public class MyBean2
+{
}
Modified: trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
===================================================================
--- trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-947/child1/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -14,5 +14,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean3 {
+public class MyBean3
+{
}
Modified: trunk/src/it/ano-947/pom.xml
===================================================================
--- trunk/src/it/ano-947/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-947/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -42,7 +42,7 @@
<packaging>pom</packaging>
- <organization>
+ <organization>
<name>License Test</name>
</organization>
Modified: trunk/src/it/ano-947/verify.groovy
===================================================================
--- trunk/src/it/ano-947/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/ano-947/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -27,109 +27,109 @@
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C) 2012 License Test' );
+assert content.contains('Copyright (C) 2012 License Test');
file = new File(basedir, 'child1/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!' );
+assert content.contains('Copyright (C) 2010 Tony');
+assert content.contains('do NOT update!');
+assert !content.contains('Fake to be removed!');
file = new File(basedir, 'child1/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!' );
+assert content.contains(' * %%Ignore-License');
+assert content.contains(' * yet another license');
+assert content.contains(' * Copyright (C) 2000 Codelutin Do not update!');
file = new File(basedir, 'child1/src/files/apt/index.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'child1/src/files/apt/index2.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'child1/src/files/rst/index.rst');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'child1/src/files/rst/index2.rst');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'child1/src/files/xml/test.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'child1/src/files/xml/test2.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'child1/src/files/properties/test.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
file = new File(basedir, 'child1/src/files/properties/test2.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert content.contains( '# #%L' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert content.contains('# #%L');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
return true;
Modified: trunk/src/it/evol-818/excluded-included/pom.xml
===================================================================
--- trunk/src/it/evol-818/excluded-included/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-818/excluded-included/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -44,25 +44,25 @@
</properties>
- <dependencies>
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-helper-plugin</artifactId>
- <version>1.2.3</version>
- </dependency>
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-utils</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ </dependencies>
- <build>
+ <build>
<pluginManagement>
<plugins>
@@ -76,80 +76,80 @@
<plugins>
<plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <executions>
- <execution>
- <id>group-filter</id>
- <goals>
- <goal>add-third-party</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <excludedGroups>org\.nuiton.*</excludedGroups>
- <thirdPartyFilename>thirdWithoutGroup.txt</thirdPartyFilename>
- </configuration>
- </execution>
- <execution>
- <id>artifact-filter</id>
- <goals>
- <goal>add-third-party</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <excludedArtifacts>nuiton-i18n</excludedArtifacts>
- <thirdPartyFilename>thirdWithoutArtifact.txt</thirdPartyFilename>
- </configuration>
- </execution>
- <execution>
- <id>artifact-off-over-group-on</id>
- <goals>
- <goal>add-third-party</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <includedGroups>org\.nuiton</includedGroups>
- <excludedArtifacts>nuiton-utils|nuiton-i18n</excludedArtifacts>
- <thirdPartyFilename>thirdWithGroupWithoutArtifact.txt</thirdPartyFilename>
- </configuration>
- </execution>
- <execution>
- <id>artifact-on-over-group-off</id>
- <goals>
- <goal>add-third-party</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <excludedGroups>org\.nuiton</excludedGroups>
- <includedArtifacts>nuiton-utils|nuiton-i18n</includedArtifacts>
- <thirdPartyFilename>thirdWithoutGroupWithArtifact.txt</thirdPartyFilename>
- </configuration>
- </execution>
- <execution>
- <id>artifact-on-over-group-on</id>
- <goals>
- <goal>add-third-party</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <includedGroups>org\.nuiton</includedGroups>
- <includedArtifacts>nuiton-utils</includedArtifacts>
- <thirdPartyFilename>thirdWithGroupWithArtifact.txt</thirdPartyFilename>
- </configuration>
- </execution>
- <execution>
- <id>artifact-off-over-group-off</id>
- <goals>
- <goal>add-third-party</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <excludedGroups>org\.nuiton</excludedGroups>
- <excludedArtifacts>nuiton-i18n</excludedArtifacts>
- <thirdPartyFilename>thirdWithoutGroupWithoutArtifact.txt</thirdPartyFilename>
- </configuration>
- </execution>
- </executions>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>group-filter</id>
+ <goals>
+ <goal>add-third-party</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <excludedGroups>org\.nuiton.*</excludedGroups>
+ <thirdPartyFilename>thirdWithoutGroup.txt</thirdPartyFilename>
+ </configuration>
+ </execution>
+ <execution>
+ <id>artifact-filter</id>
+ <goals>
+ <goal>add-third-party</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <excludedArtifacts>nuiton-i18n</excludedArtifacts>
+ <thirdPartyFilename>thirdWithoutArtifact.txt</thirdPartyFilename>
+ </configuration>
+ </execution>
+ <execution>
+ <id>artifact-off-over-group-on</id>
+ <goals>
+ <goal>add-third-party</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <includedGroups>org\.nuiton</includedGroups>
+ <excludedArtifacts>nuiton-utils|nuiton-i18n</excludedArtifacts>
+ <thirdPartyFilename>thirdWithGroupWithoutArtifact.txt</thirdPartyFilename>
+ </configuration>
+ </execution>
+ <execution>
+ <id>artifact-on-over-group-off</id>
+ <goals>
+ <goal>add-third-party</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <excludedGroups>org\.nuiton</excludedGroups>
+ <includedArtifacts>nuiton-utils|nuiton-i18n</includedArtifacts>
+ <thirdPartyFilename>thirdWithoutGroupWithArtifact.txt</thirdPartyFilename>
+ </configuration>
+ </execution>
+ <execution>
+ <id>artifact-on-over-group-on</id>
+ <goals>
+ <goal>add-third-party</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <includedGroups>org\.nuiton</includedGroups>
+ <includedArtifacts>nuiton-utils</includedArtifacts>
+ <thirdPartyFilename>thirdWithGroupWithArtifact.txt</thirdPartyFilename>
+ </configuration>
+ </execution>
+ <execution>
+ <id>artifact-off-over-group-off</id>
+ <goals>
+ <goal>add-third-party</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <excludedGroups>org\.nuiton</excludedGroups>
+ <excludedArtifacts>nuiton-i18n</excludedArtifacts>
+ <thirdPartyFilename>thirdWithoutGroupWithoutArtifact.txt</thirdPartyFilename>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
Modified: trunk/src/it/evol-818/excluded-included/verify.groovy
===================================================================
--- trunk/src/it/evol-818/excluded-included/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-818/excluded-included/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,58 +26,58 @@
file = new File(basedir, 'target/generated-sources/license/thirdWithoutGroup.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( 'commons-logging:commons-logging:1.1.1' );
-assert !content.contains( 'org.nuiton:nuiton-utils:1.4' );
-assert !content.contains( 'org.nuiton.i18n:nuiton-i18n:1.2.2' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('commons-logging:commons-logging:1.1.1');
+assert !content.contains('org.nuiton:nuiton-utils:1.4');
+assert !content.contains('org.nuiton.i18n:nuiton-i18n:1.2.2');
file = new File(basedir, 'target/generated-sources/license/thirdWithoutArtifact.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( 'commons-logging:commons-logging:1.1.1' );
-assert content.contains( 'org.nuiton:nuiton-utils:1.4' );
-assert !content.contains( 'org.nuiton.i18n:nuiton-i18n:1.2.2' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('commons-logging:commons-logging:1.1.1');
+assert content.contains('org.nuiton:nuiton-utils:1.4');
+assert !content.contains('org.nuiton.i18n:nuiton-i18n:1.2.2');
file = new File(basedir, 'target/generated-sources/license/thirdWithGroupWithoutArtifact.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert !content.contains( 'commons-logging:commons-logging:1.1.1' );
-assert !content.contains( 'org.nuiton:nuiton-utils:1.4' );
-assert !content.contains( 'org.nuiton.i18n:nuiton-i18n:1.2.2' );
-assert content.contains( 'org.nuiton:maven-helper-plugin' );
+assert !content.contains('the project has no dependencies.');
+assert !content.contains('commons-logging:commons-logging:1.1.1');
+assert !content.contains('org.nuiton:nuiton-utils:1.4');
+assert !content.contains('org.nuiton.i18n:nuiton-i18n:1.2.2');
+assert content.contains('org.nuiton:maven-helper-plugin');
file = new File(basedir, 'target/generated-sources/license/thirdWithoutGroupWithArtifact.txt');
assert file.exists();
content = file.text;
-assert content.contains( 'the project has no dependencies.' );
-assert !content.contains( 'commons-logging:commons-logging:1.1.1' );
-assert !content.contains( 'org.nuiton:nuiton-utils:1.4' );
-assert !content.contains( 'org.nuiton.i18n:nuiton-i18n:1.2.2' );
-assert !content.contains( 'org.nuiton:maven-helper-plugin' );
+assert content.contains('the project has no dependencies.');
+assert !content.contains('commons-logging:commons-logging:1.1.1');
+assert !content.contains('org.nuiton:nuiton-utils:1.4');
+assert !content.contains('org.nuiton.i18n:nuiton-i18n:1.2.2');
+assert !content.contains('org.nuiton:maven-helper-plugin');
file = new File(basedir, 'target/generated-sources/license/thirdWithGroupWithArtifact.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert !content.contains( 'commons-logging:commons-logging:1.1.1' );
-assert content.contains( 'org.nuiton:nuiton-utils:1.4' );
-assert content.contains( 'org.nuiton.i18n:nuiton-i18n:1.2.2' );
-assert content.contains( 'org.nuiton:maven-helper-plugin' );
+assert !content.contains('the project has no dependencies.');
+assert !content.contains('commons-logging:commons-logging:1.1.1');
+assert content.contains('org.nuiton:nuiton-utils:1.4');
+assert content.contains('org.nuiton.i18n:nuiton-i18n:1.2.2');
+assert content.contains('org.nuiton:maven-helper-plugin');
file = new File(basedir, 'target/generated-sources/license/thirdWithoutGroupWithoutArtifact.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert content.contains( 'commons-logging:commons-logging:1.1.1' );
-assert !content.contains( 'org.nuiton:nuiton-utils:1.4' );
-assert !content.contains( 'org.nuiton.i18n:nuiton-i18n:1.2.2' );
-assert !content.contains( 'org.nuiton:maven-helper-plugin' );
+assert !content.contains('the project has no dependencies.');
+assert content.contains('commons-logging:commons-logging:1.1.1');
+assert !content.contains('org.nuiton:nuiton-utils:1.4');
+assert !content.contains('org.nuiton.i18n:nuiton-i18n:1.2.2');
+assert !content.contains('org.nuiton:maven-helper-plugin');
return true;
Modified: trunk/src/it/evol-818/multimodule-filters/child1/pom.xml
===================================================================
--- trunk/src/it/evol-818/multimodule-filters/child1/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-818/multimodule-filters/child1/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -28,32 +28,32 @@
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>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.nuiton.license.test</groupId>
- <artifactId>evo-818-multimodule</artifactId>
- <version>1.0</version>
- </parent>
- <artifactId>evo-818-multimodule-child1</artifactId>
+ <parent>
+ <groupId>org.nuiton.license.test</groupId>
+ <artifactId>evo-818-multimodule</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>evo-818-multimodule-child1</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-helper-plugin</artifactId>
- <version>1.2.3</version>
- </dependency>
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-utils</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ </dependencies>
</project>
Modified: trunk/src/it/evol-818/multimodule-filters/child2/pom.xml
===================================================================
--- trunk/src/it/evol-818/multimodule-filters/child2/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-818/multimodule-filters/child2/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -28,34 +28,34 @@
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>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.nuiton.license.test</groupId>
- <artifactId>evo-818-multimodule</artifactId>
- <version>1.0</version>
- </parent>
- <artifactId>evo-818-multimodule-child2</artifactId>
+ <parent>
+ <groupId>org.nuiton.license.test</groupId>
+ <artifactId>evo-818-multimodule</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>evo-818-multimodule-child2</artifactId>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <license.generateBundle>true</license.generateBundle>
- <license.verbose>true</license.verbose>
- </properties>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <license.generateBundle>true</license.generateBundle>
+ <license.verbose>true</license.verbose>
+ </properties>
- <dependencies>
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-utils</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
Modified: trunk/src/it/evol-818/multimodule-filters/pom.xml
===================================================================
--- trunk/src/it/evol-818/multimodule-filters/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-818/multimodule-filters/pom.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -28,59 +28,59 @@
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>
+ <modelVersion>4.0.0</modelVersion>
- <groupId>org.nuiton.license.test</groupId>
- <artifactId>evo-818-multimodule</artifactId>
- <version>1.0</version>
+ <groupId>org.nuiton.license.test</groupId>
+ <artifactId>evo-818-multimodule</artifactId>
+ <version>1.0</version>
- <modules>
- <module>child1</module>
- <module>child2</module>
- </modules>
+ <modules>
+ <module>child1</module>
+ <module>child2</module>
+ </modules>
- <name>Evo 818 : test MultiModule</name>
+ <name>Evo 818 : test MultiModule</name>
- <packaging>pom</packaging>
+ <packaging>pom</packaging>
- <url>no-url</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <license.verbose>true</license.verbose>
- <license.includedGroups>org\.nuiton.*</license.includedGroups>
- <license.includedArtifacts>junit</license.includedArtifacts>
- <license.excludedArtifacts>nuiton-utils</license.excludedArtifacts>
- </properties>
+ <url>no-url</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <license.verbose>true</license.verbose>
+ <license.includedGroups>org\.nuiton.*</license.includedGroups>
+ <license.includedArtifacts>junit</license.includedArtifacts>
+ <license.excludedArtifacts>nuiton-utils</license.excludedArtifacts>
+ </properties>
- <build>
+ <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <version>@pom.version@</version>
- </plugin>
- </plugins>
- </pluginManagement>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <version>@pom.version@</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <executions>
- <execution>
- <id>group-filter</id>
- <goals>
- <goal>aggregate-add-third-party</goal>
- </goals>
- <phase>verify</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>group-filter</id>
+ <goals>
+ <goal>aggregate-add-third-party</goal>
+ </goals>
+ <phase>verify</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
- </build>
+ </build>
</project>
Modified: trunk/src/it/evol-818/multimodule-filters/verify.groovy
===================================================================
--- trunk/src/it/evol-818/multimodule-filters/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-818/multimodule-filters/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,10 +26,10 @@
file = new File(basedir, 'target/generated-sources/license/THIRD-PARTY.txt');
assert file.exists();
content = file.text;
-assert !content.contains( 'the project has no dependencies.' );
-assert !content.contains( 'commons-logging:commons-logging:1.1.1' );
-assert !content.contains( 'org.nuiton:nuiton-utils:1.4' );
-assert content.contains( 'org.nuiton.i18n:nuiton-i18n:1.2.2' );
-assert content.contains( 'junit:junit');
+assert !content.contains('the project has no dependencies.');
+assert !content.contains('commons-logging:commons-logging:1.1.1');
+assert !content.contains('org.nuiton:nuiton-utils:1.4');
+assert content.contains('org.nuiton.i18n:nuiton-i18n:1.2.2');
+assert content.contains('junit:junit');
return true
Modified: trunk/src/it/evol-884/update-file-header/src/files/xml/test2.xml
===================================================================
--- trunk/src/it/evol-884/update-file-header/src/files/xml/test2.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header/src/files/xml/test2.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -23,5 +23,5 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<yo/>
\ No newline at end of file
Modified: trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean.java
===================================================================
--- trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
===================================================================
--- trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean2 {
+public class MyBean2
+{
}
Modified: trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
===================================================================
--- trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -14,5 +14,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean3 {
+public class MyBean3
+{
}
Modified: trunk/src/it/evol-884/update-file-header/verify.groovy
===================================================================
--- trunk/src/it/evol-884/update-file-header/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -27,109 +27,109 @@
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C) 2012 License Test' );
+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!' );
+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!' );
+assert content.contains(' * %%Ignore-License');
+assert content.contains(' * yet another license');
+assert content.contains(' * Copyright (C) 2000 Codelutin Do not update!');
file = new File(basedir, 'src/files/apt/index.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/apt/index2.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/rst/index.rst');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/rst/index2.rst');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/xml/test.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/xml/test2.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test2.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert content.contains( '# #%L' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert content.contains('# #%L');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
return true;
Modified: trunk/src/it/evol-884/update-file-header-specific/src/files/xml/test2.xml
===================================================================
--- trunk/src/it/evol-884/update-file-header-specific/src/files/xml/test2.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header-specific/src/files/xml/test2.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -23,5 +23,5 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<yo/>
\ No newline at end of file
Modified: trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean.java
===================================================================
--- trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
===================================================================
--- trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean2 {
+public class MyBean2
+{
}
Modified: trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
===================================================================
--- trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header-specific/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -14,5 +14,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean3 {
+public class MyBean3
+{
}
Modified: trunk/src/it/evol-884/update-file-header-specific/verify.groovy
===================================================================
--- trunk/src/it/evol-884/update-file-header-specific/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-file-header-specific/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -27,63 +27,63 @@
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C) 2012 License Test' );
+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!' );
+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!' );
+assert content.contains(' * %%Ignore-License');
+assert content.contains(' * yet another license');
+assert content.contains(' * Copyright (C) 2000 Codelutin Do not update!');
file = new File(basedir, 'src/files/apt/index.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/rst/index.rst');
assert file.exists();
content = file.text;
-assert !content.contains( 'Copyright (C)' );
-assert !content.contains( '.. * #%L' );
-assert !content.contains( '.. * #L%' );
-assert !content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert !content.contains('Copyright (C)');
+assert !content.contains('.. * #%L');
+assert !content.contains('.. * #L%');
+assert !content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/xml/test.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
return true;
Modified: trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java
===================================================================
--- trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
===================================================================
--- trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean2 {
+public class MyBean2
+{
}
Modified: trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
===================================================================
--- trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -14,5 +14,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean3 {
+public class MyBean3
+{
}
Modified: trunk/src/it/evol-884/update-project-license/verify.groovy
===================================================================
--- trunk/src/it/evol-884/update-project-license/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-884/update-project-license/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -27,24 +27,24 @@
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' );
+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' );
+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' );
+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;
Modified: trunk/src/it/evol-952/src/files/xml/test2.xml
===================================================================
--- trunk/src/it/evol-952/src/files/xml/test2.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-952/src/files/xml/test2.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -23,5 +23,5 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<yo/>
\ No newline at end of file
Modified: trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean.java
===================================================================
--- trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
===================================================================
--- trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean2 {
+public class MyBean2
+{
}
Modified: trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
===================================================================
--- trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-952/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -14,5 +14,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean3 {
+public class MyBean3
+{
}
Modified: trunk/src/it/evol-952/verify.groovy
===================================================================
--- trunk/src/it/evol-952/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/evol-952/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,225 +26,220 @@
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C) 2012 License Test' );
+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!' );
+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!' );
+assert content.contains(' * %%Ignore-License');
+assert content.contains(' * yet another license');
+assert content.contains(' * Copyright (C) 2000 Codelutin Do not update!');
file = new File(basedir, 'src/files/apt/index.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/apt/index2.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/rst/index.rst');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/rst/index2.rst');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/xml/test.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/xml/test2.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test2.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert content.contains( '# #%L' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert content.contains('# #%L');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
-
-
-
-
-
// test with extra mapping
file = new File(basedir, 'src/main/java/org/nuiton/license/plugin/test/MyBean.java2');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C) 2012 License Test' );
+assert content.contains('Copyright (C) 2012 License Test');
file = new File(basedir, 'src/main/java/org/nuiton/license/plugin/test/MyBean2.java2');
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!' );
+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.java2');
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!' );
+assert content.contains(' * %%Ignore-License');
+assert content.contains(' * yet another license');
+assert content.contains(' * Copyright (C) 2000 Codelutin Do not update!');
file = new File(basedir, 'src/files/apt/index.apt2');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/apt/index2.apt2');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/rst/index.rst2');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/rst/index2.rst2');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/xml/test.xml2');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/xml/test2.xml2');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test.properties2');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test2.properties2');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert content.contains( '# #%L' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert content.contains('# #%L');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
return true;
Modified: trunk/src/it/update-file-header/src/files/xml/test2.xml
===================================================================
--- trunk/src/it/update-file-header/src/files/xml/test2.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-file-header/src/files/xml/test2.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -23,5 +23,5 @@
<http://www.gnu.org/licenses/gpl-3.0.html>.
#L%
-->
-
+
<yo/>
\ No newline at end of file
Modified: trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean.java
===================================================================
--- trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean2.java
===================================================================
--- trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean2 {
+public class MyBean2
+{
}
Modified: trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean3.java
===================================================================
--- trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-file-header/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -14,5 +14,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean3 {
+public class MyBean3
+{
}
Modified: trunk/src/it/update-file-header/verify.groovy
===================================================================
--- trunk/src/it/update-file-header/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-file-header/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -27,109 +27,109 @@
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C) 2012 License Test' );
+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!' );
+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!' );
+assert content.contains(' * %%Ignore-License');
+assert content.contains(' * yet another license');
+assert content.contains(' * Copyright (C) 2000 Codelutin Do not update!');
file = new File(basedir, 'src/files/apt/index.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/apt/index2.apt');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '~~ #%L' );
-assert content.contains( '~~ #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '~~ ~~');
+assert content.contains('Copyright (C)');
+assert content.contains('~~ #%L');
+assert content.contains('~~ #L%');
+assert content.contains('$Id');
+assert !content.contains('~~ ~~');
file = new File(basedir, 'src/files/rst/index.rst');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/rst/index2.rst');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '.. * #%L' );
-assert content.contains( '.. * #L%' );
-assert content.contains( '$Id' );
-assert ! content.contains( '.. * .. *');
+assert content.contains('Copyright (C)');
+assert content.contains('.. * #%L');
+assert content.contains('.. * #L%');
+assert content.contains('$Id');
+assert !content.contains('.. * .. *');
file = new File(basedir, 'src/files/xml/test.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/xml/test2.xml');
assert file.exists();
content = file.text;
-assert content.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" );
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '#%L' );
-assert content.contains( '#L%' );
-assert content.contains( '$Id' );
+assert content.startsWith("<?xml version='1.0' encoding='UTF-8'?>");
+assert content.contains('Copyright (C)');
+assert content.contains('#%L');
+assert content.contains('#L%');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
file = new File(basedir, 'src/files/properties/test2.properties');
assert file.exists();
content = file.text;
-assert content.contains( 'Copyright (C)' );
-assert content.contains( '# #%L' );
-assert content.contains( '# #L%' );
-assert content.contains( '# #%L' );
-assert !content.contains( '# # \n' );
-assert content.contains( '$Id' );
+assert content.contains('Copyright (C)');
+assert content.contains('# #%L');
+assert content.contains('# #L%');
+assert content.contains('# #%L');
+assert !content.contains('# # \n');
+assert content.contains('$Id');
return true;
Modified: 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 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: 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 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean2.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean2 {
+public class MyBean2
+{
}
Modified: 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 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-project-license/src/main/java/org/nuiton/license/plugin/test/MyBean3.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -14,5 +14,6 @@
*/
package org.nuiton.license.plugin.test;
-public class MyBean3 {
+public class MyBean3
+{
}
Modified: trunk/src/it/update-project-license/verify.groovy
===================================================================
--- trunk/src/it/update-project-license/verify.groovy 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/it/update-project-license/verify.groovy 2010-11-21 13:28:04 UTC (rev 1890)
@@ -27,24 +27,24 @@
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' );
+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' );
+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' );
+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;
Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractAddThirdPartyMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AbstractAddThirdPartyMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/AbstractAddThirdPartyMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -25,6 +25,14 @@
package org.nuiton.license.plugin;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingException;
+import org.nuiton.io.SortedProperties;
+import org.nuiton.plugin.PluginHelper;
+import org.nuiton.plugin.PluginWithEncoding;
+
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -35,21 +43,16 @@
import java.util.SortedSet;
import java.util.TreeMap;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectBuildingException;
-import org.nuiton.io.SortedProperties;
-import org.nuiton.plugin.PluginHelper;
-import org.nuiton.plugin.PluginWithEncoding;
-
/**
* Abstract mojo for all third-party mojos.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.3
*/
-public abstract class AbstractAddThirdPartyMojo extends AbstractLicenseMojo implements PluginWithEncoding {
+public abstract class AbstractAddThirdPartyMojo
+ extends AbstractLicenseMojo
+ implements PluginWithEncoding
+{
/**
* Directory where to generate files.
@@ -117,7 +120,7 @@
/**
* A flag to copy a bundled version of the third-party file. This is usefull
* to avoid for a final application collision name of third party file.
- *
+ * <p/>
* The file will be copied at the {@link #bundleThirdPartyPath} location.
*
* @parameter expression="${license.generateBundle}" default-value="false"
@@ -217,325 +220,386 @@
private static SortedMap<String, MavenProject> artifactCache;
- public static SortedMap<String, MavenProject> getArtifactCache() {
- if (artifactCache == null) {
+ public static SortedMap<String, MavenProject> getArtifactCache()
+ {
+ if ( artifactCache == null )
+ {
artifactCache = new TreeMap<String, MavenProject>();
}
return artifactCache;
}
- protected abstract LicenseMap createLicenseMap() throws ProjectBuildingException;
+ protected abstract LicenseMap createLicenseMap()
+ throws ProjectBuildingException;
- protected abstract SortedProperties createUnsafeMapping() throws ProjectBuildingException, IOException;
+ protected abstract SortedProperties createUnsafeMapping()
+ throws ProjectBuildingException, IOException;
@Override
- protected void init() throws Exception {
+ protected void init()
+ throws Exception
+ {
Log log = getLog();
- if (log.isDebugEnabled()) {
+ if ( log.isDebugEnabled() )
+ {
// always be verbose in debug mode
- setVerbose(true);
+ setVerbose( true );
}
- File file = new File(getOutputDirectory(), getThirdPartyFilename());
+ File file = new File( getOutputDirectory(), getThirdPartyFilename() );
- setThirdPartyFile(file);
+ setThirdPartyFile( file );
long buildTimestamp = getBuildTimestamp();
- if (isVerbose()) {
- log.info("Build start at : " + buildTimestamp);
- log.info("third-party file : " + file.lastModified());
+ if ( isVerbose() )
+ {
+ log.info( "Build start at : " + buildTimestamp );
+ log.info( "third-party file : " + file.lastModified() );
}
- setDoGenerate(isForce() || !file.exists() || buildTimestamp > file.lastModified());
+ setDoGenerate( isForce() || !file.exists() || buildTimestamp > file.lastModified() );
- if (isGenerateBundle()) {
+ if ( isGenerateBundle() )
+ {
- File bundleFile = PluginHelper.getFile(getOutputDirectory(),
- getBundleThirdPartyPath()
- );
+ File bundleFile = PluginHelper.getFile( getOutputDirectory(), getBundleThirdPartyPath() );
- if (isVerbose()) {
- log.info("bundle third-party file : " +
- bundleFile.lastModified());
+ if ( isVerbose() )
+ {
+ log.info( "bundle third-party file : " + bundleFile.lastModified() );
}
- setDoGenerateBundle(isForce() ||
- !bundleFile.exists() ||
- buildTimestamp > bundleFile.lastModified());
- } else {
+ setDoGenerateBundle( isForce() || !bundleFile.exists() || buildTimestamp > bundleFile.lastModified() );
+ }
+ else
+ {
// not generating bundled file
- setDoGenerateBundle(false);
+ setDoGenerateBundle( false );
}
licenseMap = createLicenseMap();
unsafeDependencies = licenseMap.getUnsafeDependencies();
- if (!CollectionUtils.isEmpty(unsafeDependencies) &&
- isUseMissingFile() &&
- isDoGenerate()) {
+ if ( !CollectionUtils.isEmpty( unsafeDependencies ) && isUseMissingFile() && isDoGenerate() )
+ {
// load unsafeMapping
unsafeMappings = createUnsafeMapping();
}
- if (!CollectionUtils.isEmpty(licenseMerges)) {
+ if ( !CollectionUtils.isEmpty( licenseMerges ) )
+ {
// merge licenses in license map
- for (String merge : licenseMerges) {
+ for ( String merge : licenseMerges )
+ {
merge = merge.trim();
- if (isVerbose()) {
- getLog().info("Will merge [" + merge + "]");
+ if ( isVerbose() )
+ {
+ getLog().info( "Will merge [" + merge + "]" );
}
- String[] split = merge.split("\\|");
+ String[] split = merge.split( "\\|" );
- licenseMap.mergeLicenses(split);
+ licenseMap.mergeLicenses( split );
}
}
}
- protected boolean checkUnsafeDependencies() {
+ protected boolean checkUnsafeDependencies()
+ {
SortedSet<MavenProject> unsafeDependencies = getUnsafeDependencies();
- boolean unsafe = !CollectionUtils.isEmpty(unsafeDependencies);
- if (unsafe) {
+ boolean unsafe = !CollectionUtils.isEmpty( unsafeDependencies );
+ if ( unsafe )
+ {
Log log = getLog();
- log.warn("There is " + unsafeDependencies.size() + " dependencies with no license :");
- for (MavenProject dep : unsafeDependencies) {
+ log.warn( "There is " + unsafeDependencies.size() + " dependencies with no license :" );
+ for ( MavenProject dep : unsafeDependencies )
+ {
// no license found for the dependency
- log.warn(" - " + ArtifactHelper.getArtifactId(dep.getArtifact()));
+ log.warn( " - " + ArtifactHelper.getArtifactId( dep.getArtifact() ) );
}
}
return unsafe;
}
- protected void writeThirdPartyFile() throws IOException {
+ protected void writeThirdPartyFile()
+ throws IOException
+ {
Log log = getLog();
LicenseMap licenseMap = getLicenseMap();
File target = getThirdPartyFile();
- if (isDoGenerate()) {
+ if ( isDoGenerate() )
+ {
StringBuilder sb = new StringBuilder();
- if (licenseMap.isEmpty()) {
- sb.append(NO_DEPENDENCIES_MESSAGE);
- } else {
- if (isGroupByLicense()) {
+ if ( licenseMap.isEmpty() )
+ {
+ sb.append( NO_DEPENDENCIES_MESSAGE );
+ }
+ else
+ {
+ if ( isGroupByLicense() )
+ {
// group by license
- sb.append("List of third-party dependencies grouped by " +
- "their license type.");
- for (String licenseName : licenseMap.keySet()) {
- SortedSet<MavenProject> projects = licenseMap.get(licenseName);
- sb.append("\n\n").append(licenseName).append(" : ");
+ sb.append( "List of third-party dependencies grouped by " + "their license type." );
+ for ( String licenseName : licenseMap.keySet() )
+ {
+ SortedSet<MavenProject> projects = licenseMap.get( licenseName );
+ sb.append( "\n\n" ).append( licenseName ).append( " : " );
-
- for (MavenProject mavenProject : projects) {
- String s = ArtifactHelper.getArtifactName(mavenProject);
- sb.append("\n * ").append(s);
+ for ( MavenProject mavenProject : projects )
+ {
+ String s = ArtifactHelper.getArtifactName( mavenProject );
+ sb.append( "\n * " ).append( s );
}
}
- } else {
+ }
+ else
+ {
-
// group by dependencies
SortedMap<MavenProject, String[]> map = licenseMap.toDependencyMap();
- sb.append("List of ").append(map.size()).append(" third-party dependencies.\n");
+ sb.append( "List of " ).append( map.size() ).append( " third-party dependencies.\n" );
List<String> lines = new ArrayList<String>();
- for (Map.Entry<MavenProject, String[]> entry : map.entrySet()) {
- String artifact = ArtifactHelper.getArtifactName(entry.getKey());
+ for ( Map.Entry<MavenProject, String[]> entry : map.entrySet() )
+ {
+ String artifact = ArtifactHelper.getArtifactName( entry.getKey() );
StringBuilder buffer = new StringBuilder();
- for (String license : entry.getValue()) {
- buffer.append(" (").append(license).append(")");
+ for ( String license : entry.getValue() )
+ {
+ buffer.append( " (" ).append( license ).append( ")" );
}
String licenses = buffer.toString();
String line = licenses + " " + artifact;
- lines.add(line);
+ lines.add( line );
}
- Collections.sort(lines);
- for (String line : lines) {
- sb.append('\n').append(line);
+ Collections.sort( lines );
+ for ( String line : lines )
+ {
+ sb.append( '\n' ).append( line );
}
lines.clear();
}
}
String content = sb.toString();
- log.info("Writing third-party file to " + target);
- if (isVerbose()) {
- log.info(content);
+ log.info( "Writing third-party file to " + target );
+ if ( isVerbose() )
+ {
+ log.info( content );
}
- writeFile(target, content, getEncoding());
+ writeFile( target, content, getEncoding() );
}
- if (isDoGenerateBundle()) {
+ if ( isDoGenerateBundle() )
+ {
// creates the bundled license file
- File bundleTarget =
- PluginHelper.getFile(getOutputDirectory(), getBundleThirdPartyPath());
- log.info("Writing bundled third-party file to " + bundleTarget);
- copyFile(target, bundleTarget);
+ File bundleTarget = PluginHelper.getFile( getOutputDirectory(), getBundleThirdPartyPath() );
+ log.info( "Writing bundled third-party file to " + bundleTarget );
+ copyFile( target, bundleTarget );
}
}
@Override
- public final String getEncoding() {
+ public final String getEncoding()
+ {
return encoding;
}
@Override
- public final void setEncoding(String encoding) {
+ public final void setEncoding( String encoding )
+ {
this.encoding = encoding;
}
- public boolean isGroupByLicense() {
+ public boolean isGroupByLicense()
+ {
return groupByLicense;
}
- public void setGroupByLicense(boolean groupByLicense) {
+ public void setGroupByLicense( boolean groupByLicense )
+ {
this.groupByLicense = groupByLicense;
}
- public File getOutputDirectory() {
+ public File getOutputDirectory()
+ {
return outputDirectory;
}
- public String getThirdPartyFilename() {
+ public String getThirdPartyFilename()
+ {
return thirdPartyFilename;
}
- public String getBundleThirdPartyPath() {
+ public String getBundleThirdPartyPath()
+ {
return bundleThirdPartyPath;
}
- public boolean isGenerateBundle() {
+ public boolean isGenerateBundle()
+ {
return generateBundle;
}
- public boolean isFailIfWarning() {
+ public boolean isFailIfWarning()
+ {
return failIfWarning;
}
- public SortedSet<MavenProject> getUnsafeDependencies() {
+ public SortedSet<MavenProject> getUnsafeDependencies()
+ {
return unsafeDependencies;
}
- public File getThirdPartyFile() {
+ public File getThirdPartyFile()
+ {
return thirdPartyFile;
}
- public LicenseMap getLicenseMap() {
+ public LicenseMap getLicenseMap()
+ {
return licenseMap;
}
- public void setOutputDirectory(File outputDirectory) {
+ public void setOutputDirectory( File outputDirectory )
+ {
this.outputDirectory = outputDirectory;
}
- public void setThirdPartyFilename(String thirdPartyFilename) {
+ public void setThirdPartyFilename( String thirdPartyFilename )
+ {
this.thirdPartyFilename = thirdPartyFilename;
}
- public void setBundleThirdPartyPath(String bundleThirdPartyPath) {
+ public void setBundleThirdPartyPath( String bundleThirdPartyPath )
+ {
this.bundleThirdPartyPath = bundleThirdPartyPath;
}
- public void setGenerateBundle(boolean generateBundle) {
+ public void setGenerateBundle( boolean generateBundle )
+ {
this.generateBundle = generateBundle;
}
- public void setThirdPartyFile(File thirdPartyFile) {
+ public void setThirdPartyFile( File thirdPartyFile )
+ {
this.thirdPartyFile = thirdPartyFile;
}
- public boolean isUseMissingFile() {
+ public boolean isUseMissingFile()
+ {
return useMissingFile;
}
- public File getMissingFile() {
+ public File getMissingFile()
+ {
return missingFile;
}
- public void setUseMissingFile(boolean useMissingFile) {
+ public void setUseMissingFile( boolean useMissingFile )
+ {
this.useMissingFile = useMissingFile;
}
- public void setMissingFile(File missingFile) {
+ public void setMissingFile( File missingFile )
+ {
this.missingFile = missingFile;
}
- public void setFailIfWarning(boolean failIfWarning) {
+ public void setFailIfWarning( boolean failIfWarning )
+ {
this.failIfWarning = failIfWarning;
}
- public SortedProperties getUnsafeMappings() {
+ public SortedProperties getUnsafeMappings()
+ {
return unsafeMappings;
}
- public boolean isForce() {
+ public boolean isForce()
+ {
return force;
}
- public boolean isDoGenerate() {
+ public boolean isDoGenerate()
+ {
return doGenerate;
}
- public void setForce(boolean force) {
+ public void setForce( boolean force )
+ {
this.force = force;
}
- public void setDoGenerate(boolean doGenerate) {
+ public void setDoGenerate( boolean doGenerate )
+ {
this.doGenerate = doGenerate;
}
- public boolean isDoGenerateBundle() {
+ public boolean isDoGenerateBundle()
+ {
return doGenerateBundle;
}
- public void setDoGenerateBundle(boolean doGenerateBundle) {
+ public void setDoGenerateBundle( boolean doGenerateBundle )
+ {
this.doGenerateBundle = doGenerateBundle;
}
- public String getExcludedGroups() {
+ public String getExcludedGroups()
+ {
return excludedGroups;
}
- public void setExcludedGroups(String excludedGroups) {
+ public void setExcludedGroups( String excludedGroups )
+ {
this.excludedGroups = excludedGroups;
}
- public String getIncludedGroups() {
+ public String getIncludedGroups()
+ {
return includedGroups;
}
- public void setIncludedGroups(String includedGroups) {
+ public void setIncludedGroups( String includedGroups )
+ {
this.includedGroups = includedGroups;
}
- public String getExcludedArtifacts() {
+ public String getExcludedArtifacts()
+ {
return excludedArtifacts;
}
- public void setExcludedArtifacts(String excludedArtifacts) {
+ public void setExcludedArtifacts( String excludedArtifacts )
+ {
this.excludedArtifacts = excludedArtifacts;
}
- public String getIncludedArtifacts() {
+ public String getIncludedArtifacts()
+ {
return includedArtifacts;
}
- public void setIncludedArtifacts(String includedArtifacts) {
+ public void setIncludedArtifacts( String includedArtifacts )
+ {
this.includedArtifacts = includedArtifacts;
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -39,7 +39,9 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public abstract class AbstractLicenseMojo extends AbstractPlugin {
+public abstract class AbstractLicenseMojo
+ extends AbstractPlugin
+{
/**
* Current maven session. (used to launch certain mojo once by build).
@@ -72,59 +74,73 @@
private boolean verbose;
@Override
- public final MavenProject getProject() {
+ public final MavenProject getProject()
+ {
return project;
}
@Override
- public final void setProject(MavenProject project) {
+ public final void setProject( MavenProject project )
+ {
this.project = project;
}
@Override
- public final boolean isVerbose() {
+ public final boolean isVerbose()
+ {
return verbose;
}
@Override
- public final void setVerbose(boolean verbose) {
+ public final void setVerbose( boolean verbose )
+ {
this.verbose = verbose;
}
- public final MavenSession getSession() {
+ public final MavenSession getSession()
+ {
return session;
}
- public final void setSession(MavenSession session) {
+ public final void setSession( MavenSession session )
+ {
this.session = session;
}
- public final long getBuildTimestamp() {
+ public final long getBuildTimestamp()
+ {
return session.getStartTime().getTime();
}
- protected LicenseStore createLicenseStore(String... extraResolver)
- throws MojoExecutionException {
+ protected LicenseStore createLicenseStore( String... extraResolver )
+ throws MojoExecutionException
+ {
LicenseStore store;
- try {
+ try
+ {
store = new LicenseStore();
store.addJarRepository();
- if (extraResolver != null) {
- for (String s : extraResolver) {
- if (s != null && !s.trim().isEmpty()) {
- getLog().info("adding extra resolver " + s);
- store.addRepository(s);
+ if ( extraResolver != null )
+ {
+ for ( String s : extraResolver )
+ {
+ if ( s != null && !s.trim().isEmpty() )
+ {
+ getLog().info( "adding extra resolver " + s );
+ store.addRepository( s );
}
}
}
store.init();
- } catch (IllegalArgumentException ex) {
- throw new MojoExecutionException(
- "could not obtain the license repository", ex);
- } catch (IOException ex) {
- throw new MojoExecutionException(
- "could not obtain the license repository", ex);
}
+ catch ( IllegalArgumentException ex )
+ {
+ throw new MojoExecutionException( "could not obtain the license repository", ex );
+ }
+ catch ( IOException ex )
+ {
+ throw new MojoExecutionException( "could not obtain the license repository", ex );
+ }
return store;
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseNameMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseNameMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/AbstractLicenseNameMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -40,7 +40,10 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public abstract class AbstractLicenseNameMojo extends AbstractLicenseMojo implements PluginWithEncoding {
+public abstract class AbstractLicenseNameMojo
+ extends AbstractLicenseMojo
+ implements PluginWithEncoding
+{
/**
* Encoding used to read and writes files.
@@ -79,7 +82,9 @@
*/
private String licenseName;
- /** store of licenses */
+ /**
+ * store of licenses
+ */
private LicenseStore licenseStore;
/**
@@ -97,54 +102,62 @@
*
* @param skip new state value
*/
- public abstract void setSkip(boolean skip);
+ public abstract void setSkip( boolean skip );
@Override
- protected boolean checkSkip() {
- if (isSkip()) {
- getLog().info("skip flag is on, will skip goal.");
+ 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 {
+ protected void init()
+ throws Exception
+ {
- if (isSkip()) {
+ if ( isSkip() )
+ {
return;
}
// init licenses store
- LicenseStore licenseStore = createLicenseStore(getLicenseResolver());
- setLicenseStore(licenseStore);
+ LicenseStore licenseStore = createLicenseStore( getLicenseResolver() );
+ setLicenseStore( licenseStore );
// check licenseName exists
- checkLicense(licenseName);
+ checkLicense( licenseName );
}
public License getMainLicense()
- throws IllegalArgumentException, IllegalStateException, MojoFailureException {
+ throws IllegalArgumentException, IllegalStateException, MojoFailureException
+ {
// check license exists
- checkLicense(licenseName);
+ checkLicense( licenseName );
// obtain license from his name
- License mainLicense = getLicense(licenseName);
+ License mainLicense = getLicense( licenseName );
return mainLicense;
}
- public License getLicense(String licenseName)
- throws IllegalArgumentException, IllegalStateException {
- if (StringUtils.isEmpty(licenseName)) {
- throw new IllegalArgumentException(
- "licenseName can not be null, nor empty");
+ 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!");
+ if ( licenseStore == null )
+ {
+ throw new IllegalStateException( "No license store initialized!" );
}
- License mainLicense = licenseStore.getLicense(licenseName);
+ License mainLicense = licenseStore.getLicense( licenseName );
return mainLicense;
}
@@ -158,65 +171,75 @@
* @throws MojoFailureException if license does not exist
* @since 2.4.1
*/
- protected void checkLicense(String licenseName)
- throws IllegalArgumentException,
- IllegalStateException, MojoFailureException {
- if (StringUtils.isEmpty(licenseName)) {
- throw new IllegalArgumentException(
- "licenseName can not be null, nor empty");
+ protected void checkLicense( String licenseName )
+ throws IllegalArgumentException, IllegalStateException, MojoFailureException
+ {
+ 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!");
+ if ( licenseStore == null )
+ {
+ throw new IllegalStateException( "No license store initialized!" );
}
- License mainLicense = licenseStore.getLicense(licenseName);
- if (mainLicense == null) {
- throw new MojoFailureException(
- "License named '" + mainLicense +
- "' is unknown, use one of " +
- Arrays.toString(licenseStore.getLicenseNames()));
+ License mainLicense = licenseStore.getLicense( licenseName );
+ if ( mainLicense == null )
+ {
+ throw new MojoFailureException( "License named '" + mainLicense + "' is unknown, use one of " +
+ Arrays.toString( licenseStore.getLicenseNames() ) );
}
}
@Override
- public final String getEncoding() {
+ public final String getEncoding()
+ {
return encoding;
}
@Override
- public final void setEncoding(String encoding) {
+ public final void setEncoding( String encoding )
+ {
this.encoding = encoding;
}
- public boolean isKeepBackup() {
+ public boolean isKeepBackup()
+ {
return keepBackup;
}
- public String getLicenseName() {
+ public String getLicenseName()
+ {
return licenseName;
}
- public String getLicenseResolver() {
+ public String getLicenseResolver()
+ {
return licenseResolver;
}
- public LicenseStore getLicenseStore() {
+ public LicenseStore getLicenseStore()
+ {
return licenseStore;
}
- public void setKeepBackup(boolean keepBackup) {
+ public void setKeepBackup( boolean keepBackup )
+ {
this.keepBackup = keepBackup;
}
- public void setLicenseResolver(String licenseResolver) {
+ public void setLicenseResolver( String licenseResolver )
+ {
this.licenseResolver = licenseResolver;
}
- public void setLicenseName(String licenseName) {
+ public void setLicenseName( String licenseName )
+ {
this.licenseName = licenseName;
}
- public void setLicenseStore(LicenseStore licenseStore) {
+ public void setLicenseStore( LicenseStore licenseStore )
+ {
this.licenseStore = licenseStore;
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -49,10 +49,10 @@
/**
* The gola to generate the third-party file.
- *
+ * <p/>
* This file contains for all dependencies of the project a line giving the
* license used by the dependency.
- *
+ * <p/>
* It will also copy it in the class-path (says add the generated directory as
* a resource of the build).
*
@@ -63,7 +63,9 @@
* @requiresProject true
* @since 2.2 (was previously {@code AddThirdPartyFileMojo}).
*/
-public class AddThirdPartyMojo extends AbstractAddThirdPartyMojo {
+public class AddThirdPartyMojo
+ extends AbstractAddThirdPartyMojo
+{
/**
* Local Repository.
@@ -98,22 +100,25 @@
private boolean doGenerateMissing;
@Override
- protected boolean checkPackaging() {
- return rejectPackaging(Packaging.pom);
+ protected boolean checkPackaging()
+ {
+ return rejectPackaging( Packaging.pom );
}
@Override
- protected LicenseMap createLicenseMap() throws ProjectBuildingException {
+ protected LicenseMap createLicenseMap()
+ throws ProjectBuildingException
+ {
Log log = getLog();
LicenseMap licenseMap = new LicenseMap();
- licenseMap.setLog(log);
+ licenseMap.setLog( log );
- boolean haveNoIncludedGroups = StringUtils.isEmpty(includedGroups);
- boolean haveNoIncludedArtifacts = StringUtils.isEmpty(includedArtifacts);
+ boolean haveNoIncludedGroups = StringUtils.isEmpty( includedGroups );
+ boolean haveNoIncludedArtifacts = StringUtils.isEmpty( includedArtifacts );
- boolean haveExcludedGroups = StringUtils.isNotEmpty(excludedGroups);
- boolean haveExcludedArtifacts = StringUtils.isNotEmpty(excludedArtifacts);
+ boolean haveExcludedGroups = StringUtils.isNotEmpty( excludedGroups );
+ boolean haveExcludedArtifacts = StringUtils.isNotEmpty( excludedArtifacts );
boolean haveExclusions = haveExcludedGroups || haveExcludedArtifacts;
Pattern includedGroupPattern = null;
@@ -121,47 +126,54 @@
Pattern excludedGroupPattern = null;
Pattern excludedArtifactPattern = null;
- if (!haveNoIncludedGroups) {
- includedGroupPattern = Pattern.compile(includedGroups);
+ if ( !haveNoIncludedGroups )
+ {
+ includedGroupPattern = Pattern.compile( includedGroups );
}
- if (!haveNoIncludedArtifacts) {
- includedArtifactPattern = Pattern.compile(includedArtifacts);
+ if ( !haveNoIncludedArtifacts )
+ {
+ includedArtifactPattern = Pattern.compile( includedArtifacts );
}
- if (haveExcludedGroups) {
- excludedGroupPattern = Pattern.compile(excludedGroups);
+ if ( haveExcludedGroups )
+ {
+ excludedGroupPattern = Pattern.compile( excludedGroups );
}
- if (haveExcludedArtifacts) {
- excludedArtifactPattern = Pattern.compile(excludedArtifacts);
+ if ( haveExcludedArtifacts )
+ {
+ excludedArtifactPattern = Pattern.compile( excludedArtifacts );
}
// build the license map for the dependencies of the project
- for (Object o : getProject().getArtifacts()) {
+ for ( Object o : getProject().getArtifacts() )
+ {
Artifact artifact = (Artifact) o;
- if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) {
+ if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+ {
// never treate system artifacts (they are mysterious and
// no information can be retrive from anywhere)...
continue;
}
- String id = ArtifactHelper.getArtifactId(artifact);
- if (isVerbose()) {
- getLog().info("detected artifact " + id);
+ String id = ArtifactHelper.getArtifactId( artifact );
+ if ( isVerbose() )
+ {
+ getLog().info( "detected artifact " + id );
}
// Check if the project should be included
// If there is no specified artifacts and group to include, include all
- boolean isToInclude = haveNoIncludedArtifacts && haveNoIncludedGroups
- || isIncludable(artifact, includedGroupPattern, includedArtifactPattern);
+ boolean isToInclude = haveNoIncludedArtifacts && haveNoIncludedGroups ||
+ isIncludable( artifact, includedGroupPattern, includedArtifactPattern );
// Check if the project should be excluded
- boolean isToExclude = isToInclude
- && haveExclusions
- && isExcludable(artifact, excludedGroupPattern, excludedArtifactPattern);
+ boolean isToExclude = isToInclude && haveExclusions &&
+ isExcludable( artifact, excludedGroupPattern, excludedArtifactPattern );
- if (isToInclude && !isToExclude) {
- MavenProject project = addArtifact(id, artifact);
- licenseMap.addLicense(project, project.getLicenses());
+ if ( isToInclude && !isToExclude )
+ {
+ MavenProject project = addArtifact( id, artifact );
+ licenseMap.addLicense( project, project.getLicenses() );
}
}
@@ -169,40 +181,43 @@
}
@Override
- protected SortedProperties createUnsafeMapping() throws ProjectBuildingException, IOException {
+ protected SortedProperties createUnsafeMapping()
+ throws ProjectBuildingException, IOException
+ {
- SortedProperties unsafeMappings =
- getLicenseMap().loadUnsafeMapping(getEncoding(),
- getMissingFile());
+ SortedProperties unsafeMappings = getLicenseMap().loadUnsafeMapping( getEncoding(), getMissingFile() );
SortedSet<MavenProject> unsafeDependencies = getUnsafeDependencies();
- if (isVerbose()) {
- getLog().info("found " + unsafeMappings.size() + " unsafe mappings");
+ if ( isVerbose() )
+ {
+ getLog().info( "found " + unsafeMappings.size() + " unsafe mappings" );
}
// compute if missing file should be (re)-generate
- boolean generateMissingfile = computeDoGenerateMissingFile(
- unsafeMappings,
- unsafeDependencies
- );
+ boolean generateMissingfile = computeDoGenerateMissingFile( unsafeMappings, unsafeDependencies );
- setDoGenerateMissing(generateMissingfile);
+ setDoGenerateMissing( generateMissingfile );
- if (generateMissingfile && isVerbose()) {
+ if ( generateMissingfile && isVerbose() )
+ {
StringBuilder sb = new StringBuilder();
- sb.append("Will use from missing file ");
- sb.append(unsafeMappings.size());
- sb.append(" dependencies :");
- for (Map.Entry<Object, Object> entry : unsafeMappings.entrySet()) {
+ sb.append( "Will use from missing file " );
+ sb.append( unsafeMappings.size() );
+ sb.append( " dependencies :" );
+ for ( Map.Entry<Object, Object> entry : unsafeMappings.entrySet() )
+ {
String id = (String) entry.getKey();
String license = (String) entry.getValue();
- sb.append("\n - ").append(id).append(" - ").append(license);
+ sb.append( "\n - " ).append( id ).append( " - " ).append( license );
}
- getLog().info(sb.toString());
- } else {
- if (isUseMissingFile() && !unsafeMappings.isEmpty()) {
- getLog().info("Missing file " + getMissingFile() + " is up-to-date.");
+ getLog().info( sb.toString() );
+ }
+ else
+ {
+ if ( isUseMissingFile() && !unsafeMappings.isEmpty() )
+ {
+ getLog().info( "Missing file " + getMissingFile() + " is up-to-date." );
}
}
return unsafeMappings;
@@ -215,22 +230,29 @@
* @throws IOException if any IO problem
* @since 3.0
*/
- protected boolean computeDoGenerateMissingFile(SortedProperties unsafeMappings,
- SortedSet<MavenProject> unsafeDependencies) throws IOException {
+ protected boolean computeDoGenerateMissingFile( SortedProperties unsafeMappings,
+ SortedSet<MavenProject> unsafeDependencies )
+ throws IOException
+ {
- if (!isUseMissingFile()) {
+ if ( !isUseMissingFile() )
+ {
// never use the missing file
return false;
}
- if (isForce()) {
+ if ( isForce() )
+ {
// the mapping fro missing file is not empty, regenerate it
- return !CollectionUtils.isEmpty(unsafeMappings.keySet());
- } else {
+ return !CollectionUtils.isEmpty( unsafeMappings.keySet() );
+ }
+ else
+ {
- if (!CollectionUtils.isEmpty(unsafeDependencies)) {
+ if ( !CollectionUtils.isEmpty( unsafeDependencies ) )
+ {
// there is some unsafe dependencies from the project, must
// regenerate missing file
@@ -238,146 +260,168 @@
}
// check if the missing file has changed
- SortedProperties oldUnsafeMappings = new SortedProperties(getEncoding());
- oldUnsafeMappings.load(getMissingFile());
- return !unsafeMappings.equals(oldUnsafeMappings);
+ SortedProperties oldUnsafeMappings = new SortedProperties( getEncoding() );
+ oldUnsafeMappings.load( getMissingFile() );
+ return !unsafeMappings.equals( oldUnsafeMappings );
}
}
@Override
- protected boolean checkSkip() {
- if (!isDoGenerate() &&
- !isDoGenerateBundle() &&
- !isDoGenerateMissing()) {
+ protected boolean checkSkip()
+ {
+ if ( !isDoGenerate() && !isDoGenerateBundle() && !isDoGenerateMissing() )
+ {
- getLog().info("All files are up to date, skip goal execution.");
+ getLog().info( "All files are up to date, skip goal execution." );
return false;
}
return true;
}
@Override
- protected void doAction() throws Exception {
+ protected void doAction()
+ throws Exception
+ {
boolean unsafe = checkUnsafeDependencies();
writeThirdPartyFile();
- if (isDoGenerateMissing()) {
+ if ( isDoGenerateMissing() )
+ {
writeMissingFile();
}
- if (unsafe && isFailIfWarning()) {
- throw new MojoFailureException("There is some dependencies with no license, please fill the file " + getMissingFile());
+ if ( unsafe && isFailIfWarning() )
+ {
+ throw new MojoFailureException(
+ "There is some dependencies with no license, please fill the file " + getMissingFile() );
}
- addResourceDir(getOutputDirectory(), "**/*.txt");
+ addResourceDir( getOutputDirectory(), "**/*.txt" );
}
- protected void writeMissingFile() throws IOException {
+ protected void writeMissingFile()
+ throws IOException
+ {
Log log = getLog();
LicenseMap licenseMap = getLicenseMap();
File file = getMissingFile();
- createDirectoryIfNecessary(file.getParentFile());
- log.info("Regenerate missing license file " + file);
+ createDirectoryIfNecessary( file.getParentFile() );
+ log.info( "Regenerate missing license file " + file );
- FileWriter writer = new FileWriter(file);
- try {
- StringBuilder sb = new StringBuilder(" Generated by " + getClass().getName());
- List<String> licenses = new ArrayList<String>(licenseMap.keySet());
- licenses.remove(LicenseMap.getUnknownLicenseMessage());
- if (!licenses.isEmpty()) {
- sb.append("\n-------------------------------------------------------------------------------");
- sb.append("\n Already used licenses in project :");
- for (String license : licenses) {
- sb.append("\n - ").append(license);
+ FileWriter writer = new FileWriter( file );
+ try
+ {
+ StringBuilder sb = new StringBuilder( " Generated by " + getClass().getName() );
+ List<String> licenses = new ArrayList<String>( licenseMap.keySet() );
+ licenses.remove( LicenseMap.getUnknownLicenseMessage() );
+ if ( !licenses.isEmpty() )
+ {
+ sb.append( "\n-------------------------------------------------------------------------------" );
+ sb.append( "\n Already used licenses in project :" );
+ for ( String license : licenses )
+ {
+ sb.append( "\n - " ).append( license );
}
}
- sb.append("\n-------------------------------------------------------------------------------");
- sb.append("\n Please fill the missing licenses for dependencies :\n\n");
- getUnsafeMappings().store(writer, sb.toString());
- } finally {
+ sb.append( "\n-------------------------------------------------------------------------------" );
+ sb.append( "\n Please fill the missing licenses for dependencies :\n\n" );
+ getUnsafeMappings().store( writer, sb.toString() );
+ }
+ finally
+ {
writer.close();
}
}
- protected MavenProject addArtifact(String id,
- Artifact artifact) throws ProjectBuildingException {
+ protected MavenProject addArtifact( String id, Artifact artifact )
+ throws ProjectBuildingException
+ {
- MavenProject project = getArtifactCache().get(id);
+ MavenProject project = getArtifactCache().get( id );
Log log = getLog();
- if (project != null) {
- if (isVerbose()) {
- log.info("add dependency [" + id + "] (from cache)");
+ if ( project != null )
+ {
+ if ( isVerbose() )
+ {
+ log.info( "add dependency [" + id + "] (from cache)" );
}
- } else {
- project = mavenProjectBuilder.buildFromRepository(
- artifact,
- remoteRepositories,
- localRepository,
- true
- );
- if (isVerbose()) {
- log.info("add dependency [" + id + "]");
+ }
+ else
+ {
+ project = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository, true );
+ if ( isVerbose() )
+ {
+ log.info( "add dependency [" + id + "]" );
}
- getArtifactCache().put(id, project);
+ getArtifactCache().put( id, project );
}
return project;
}
- public boolean isDoGenerateMissing() {
+ public boolean isDoGenerateMissing()
+ {
return doGenerateMissing;
}
- public void setDoGenerateMissing(boolean doGenerateMissing) {
+ public void setDoGenerateMissing( boolean doGenerateMissing )
+ {
this.doGenerateMissing = doGenerateMissing;
}
- protected boolean isIncludable(Artifact project,
- Pattern includedGroupPattern,
- Pattern includedArtifactPattern) {
+ protected boolean isIncludable( Artifact project, Pattern includedGroupPattern, Pattern includedArtifactPattern )
+ {
Log log = getLog();
// check if the groupId of the project should be included
- if (includedGroupPattern != null) {
+ if ( includedGroupPattern != null )
+ {
// we have some defined license filters
- try {
- Matcher matchGroupId = includedGroupPattern.matcher(project.getGroupId());
- if (matchGroupId.find()) {
- if (log.isDebugEnabled()) {
- log.debug("Include " + project.getGroupId());
+ try
+ {
+ Matcher matchGroupId = includedGroupPattern.matcher( project.getGroupId() );
+ if ( matchGroupId.find() )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Include " + project.getGroupId() );
}
return true;
}
}
- catch (PatternSyntaxException e) {
- getLog().warn("The pattern specified by expression <"
- + includedGroups + "> seems to be invalid.");
+ catch ( PatternSyntaxException e )
+ {
+ getLog().warn( "The pattern specified by expression <" + includedGroups + "> seems to be invalid." );
}
}
// check if the artifactId of the project should be included
- if (includedArtifactPattern != null) {
+ if ( includedArtifactPattern != null )
+ {
// we have some defined license filters
- try {
- Matcher matchGroupId = includedArtifactPattern.matcher(project.getArtifactId());
- if (matchGroupId.find()) {
- if (log.isDebugEnabled()) {
- log.debug("Include " + project.getArtifactId());
+ try
+ {
+ Matcher matchGroupId = includedArtifactPattern.matcher( project.getArtifactId() );
+ if ( matchGroupId.find() )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Include " + project.getArtifactId() );
}
return true;
}
}
- catch (PatternSyntaxException e) {
- getLog().warn("The pattern specified by expression <"
- + includedArtifacts + "> seems to be invalid.");
+ catch ( PatternSyntaxException e )
+ {
+ getLog().warn( "The pattern specified by expression <" + includedArtifacts + "> seems to be invalid." );
}
}
@@ -385,44 +429,51 @@
}
- protected boolean isExcludable(Artifact project,
- Pattern excludedGroupPattern,
- Pattern excludedArtifactPattern) {
+ protected boolean isExcludable( Artifact project, Pattern excludedGroupPattern, Pattern excludedArtifactPattern )
+ {
Log log = getLog();
// check if the groupId of the project should be included
- if (excludedGroupPattern != null) {
+ if ( excludedGroupPattern != null )
+ {
// we have some defined license filters
- try {
- Matcher matchGroupId = excludedGroupPattern.matcher(project.getGroupId());
- if (matchGroupId.find()) {
- if (log.isDebugEnabled()) {
- log.debug("Exclude " + project.getGroupId());
+ try
+ {
+ Matcher matchGroupId = excludedGroupPattern.matcher( project.getGroupId() );
+ if ( matchGroupId.find() )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Exclude " + project.getGroupId() );
}
return true;
}
}
- catch (PatternSyntaxException e) {
- getLog().warn("The pattern specified by expression <"
- + excludedGroups + "> seems to be invalid.");
+ catch ( PatternSyntaxException e )
+ {
+ getLog().warn( "The pattern specified by expression <" + excludedGroups + "> seems to be invalid." );
}
}
// check if the artifactId of the project should be included
- if (excludedArtifactPattern != null) {
+ if ( excludedArtifactPattern != null )
+ {
// we have some defined license filters
- try {
- Matcher matchGroupId = excludedArtifactPattern.matcher(project.getArtifactId());
- if (matchGroupId.find()) {
- if (log.isDebugEnabled()) {
- log.debug("Exclude " + project.getArtifactId());
+ try
+ {
+ Matcher matchGroupId = excludedArtifactPattern.matcher( project.getArtifactId() );
+ if ( matchGroupId.find() )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Exclude " + project.getArtifactId() );
}
return true;
}
}
- catch (PatternSyntaxException e) {
- getLog().warn("The pattern specified by expression <"
- + excludedArtifacts + "> seems to be invalid.");
+ catch ( PatternSyntaxException e )
+ {
+ getLog().warn( "The pattern specified by expression <" + excludedArtifacts + "> seems to be invalid." );
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/AggregatorAddThirdPartyMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AggregatorAddThirdPartyMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/AggregatorAddThirdPartyMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -25,12 +25,6 @@
package org.nuiton.license.plugin;
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.SortedSet;
-
import org.apache.commons.collections.CollectionUtils;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
@@ -38,6 +32,12 @@
import org.apache.maven.project.ProjectBuildingException;
import org.nuiton.io.SortedProperties;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.SortedSet;
+
/**
* This aggregator goal (will be executed only once and only on pom projects)
* executed the {@code add-third-party} on all his modules (in a parellel build cycle)
@@ -51,7 +51,9 @@
* @execute goal="add-third-party"
* @since 2.3
*/
-public class AggregatorAddThirdPartyMojo extends AbstractAddThirdPartyMojo {
+public class AggregatorAddThirdPartyMojo
+ extends AbstractAddThirdPartyMojo
+{
/**
* The projects in the reactor.
@@ -64,61 +66,73 @@
protected List<?> reactorProjects;
@Override
- protected boolean checkPackaging() {
- return acceptPackaging(Packaging.pom);
+ protected boolean checkPackaging()
+ {
+ return acceptPackaging( Packaging.pom );
}
@Override
- protected boolean checkSkip() {
- if (!isDoGenerate() &&
- !isDoGenerateBundle()) {
+ protected boolean checkSkip()
+ {
+ if ( !isDoGenerate() && !isDoGenerateBundle() )
+ {
- getLog().info("All files are up to date, skip goal execution.");
+ getLog().info( "All files are up to date, skip goal execution." );
return false;
}
return super.checkSkip();
}
@Override
- protected LicenseMap createLicenseMap() throws ProjectBuildingException {
+ protected LicenseMap createLicenseMap()
+ throws ProjectBuildingException
+ {
Log log = getLog();
LicenseMap licenseMap = new LicenseMap();
- licenseMap.setLog(log);
+ licenseMap.setLog( log );
SortedMap<String, MavenProject> artifacts = getArtifactCache();
- for (MavenProject project : artifacts.values()) {
- licenseMap.addLicense(project, project.getLicenses());
+ for ( MavenProject project : artifacts.values() )
+ {
+ licenseMap.addLicense( project, project.getLicenses() );
}
return licenseMap;
}
@Override
- protected SortedProperties createUnsafeMapping() throws ProjectBuildingException, IOException {
+ protected SortedProperties createUnsafeMapping()
+ throws ProjectBuildingException, IOException
+ {
- String path = getMissingFile().getAbsolutePath().substring(getProject().getBasedir().getAbsolutePath().length() + 1);
+ String path =
+ getMissingFile().getAbsolutePath().substring( getProject().getBasedir().getAbsolutePath().length() + 1 );
- if (isVerbose()) {
- getLog().info("Use missing file path : " + path);
+ if ( isVerbose() )
+ {
+ getLog().info( "Use missing file path : " + path );
}
- SortedProperties unsafeMappings = new SortedProperties(getEncoding());
+ SortedProperties unsafeMappings = new SortedProperties( getEncoding() );
LicenseMap licenseMap = getLicenseMap();
- for (Object o : reactorProjects) {
+ for ( Object o : reactorProjects )
+ {
MavenProject p = (MavenProject) o;
- File file = new File(p.getBasedir(), path);
+ File file = new File( p.getBasedir(), path );
- if (file.exists()) {
+ if ( file.exists() )
+ {
- SortedProperties tmp = licenseMap.loadUnsafeMapping(getEncoding(), file);
- unsafeMappings.putAll(tmp);
+ SortedProperties tmp = licenseMap.loadUnsafeMapping( getEncoding(), file );
+ unsafeMappings.putAll( tmp );
}
SortedSet<MavenProject> unsafes = licenseMap.getUnsafeDependencies();
- if (CollectionUtils.isEmpty(unsafes)) {
+ if ( CollectionUtils.isEmpty( unsafes ) )
+ {
// no more unsafe dependencies, can break
break;
@@ -128,34 +142,42 @@
}
@Override
- protected void doAction() throws Exception {
+ protected void doAction()
+ throws Exception
+ {
Log log = getLog();
- if (isVerbose()) {
- log.info("After executing on " + reactorProjects.size() + " project(s)");
+ if ( isVerbose() )
+ {
+ log.info( "After executing on " + reactorProjects.size() + " project(s)" );
}
SortedMap<String, MavenProject> artifacts = getArtifactCache();
LicenseMap licenseMap = getLicenseMap();
- getLog().info(artifacts.size() + " detected artifact(s).");
- if (isVerbose()) {
- for (String id : artifacts.keySet()) {
- getLog().info(" - " + id);
+ getLog().info( artifacts.size() + " detected artifact(s)." );
+ if ( isVerbose() )
+ {
+ for ( String id : artifacts.keySet() )
+ {
+ getLog().info( " - " + id );
}
}
- getLog().info(licenseMap.size() + " detected license(s).");
- if (isVerbose()) {
- for (String id : licenseMap.keySet()) {
- getLog().info(" - " + id);
+ getLog().info( licenseMap.size() + " detected license(s)." );
+ if ( isVerbose() )
+ {
+ for ( String id : licenseMap.keySet() )
+ {
+ getLog().info( " - " + id );
}
}
boolean unsafe = checkUnsafeDependencies();
writeThirdPartyFile();
- if (unsafe && isFailIfWarning()) {
- throw new MojoFailureException("There is some dependencies with no license, please review the modules.");
+ if ( unsafe && isFailIfWarning() )
+ {
+ throw new MojoFailureException( "There is some dependencies with no license, please review the modules." );
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/ArtifactHelper.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/ArtifactHelper.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/ArtifactHelper.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -36,61 +36,73 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.4.2
*/
-public class ArtifactHelper {
+public class ArtifactHelper
+{
protected static Comparator<MavenProject> projectComparator;
- public static String getArtifactId(Artifact artifact) {
+ public static String getArtifactId( Artifact artifact )
+ {
StringBuilder sb = new StringBuilder();
- sb.append(artifact.getGroupId());
- sb.append("--");
- sb.append(artifact.getArtifactId());
- sb.append("--");
- sb.append(artifact.getVersion());
+ sb.append( artifact.getGroupId() );
+ sb.append( "--" );
+ sb.append( artifact.getArtifactId() );
+ sb.append( "--" );
+ sb.append( artifact.getVersion() );
String type = artifact.getType();
- if (!StringUtils.isEmpty(type) && !"pom".equals(type)) {
- sb.append("--");
- sb.append(artifact.getType());
+ if ( !StringUtils.isEmpty( type ) && !"pom".equals( type ) )
+ {
+ sb.append( "--" );
+ sb.append( artifact.getType() );
}
- if (!StringUtils.isEmpty(artifact.getClassifier())) {
- sb.append("--");
- sb.append(artifact.getClassifier());
+ if ( !StringUtils.isEmpty( artifact.getClassifier() ) )
+ {
+ sb.append( "--" );
+ sb.append( artifact.getClassifier() );
}
return sb.toString();
}
- public static String getArtifactName(MavenProject project) {
+ public static String getArtifactName( MavenProject project )
+ {
StringBuilder sb = new StringBuilder();
- if (project.getName().startsWith("Unnamed -")) {
+ if ( project.getName().startsWith( "Unnamed -" ) )
+ {
// as in Maven 3, let's use the artifact id
- sb.append(project.getArtifactId());
- }else {
- sb.append(project.getName());
+ sb.append( project.getArtifactId() );
}
- sb.append(" (");
- sb.append(project.getGroupId());
- sb.append(":");
- sb.append(project.getArtifactId());
- sb.append(":");
- sb.append(project.getVersion());
- sb.append(" - ");
+ else
+ {
+ sb.append( project.getName() );
+ }
+ sb.append( " (" );
+ sb.append( project.getGroupId() );
+ sb.append( ":" );
+ sb.append( project.getArtifactId() );
+ sb.append( ":" );
+ sb.append( project.getVersion() );
+ sb.append( " - " );
String url = project.getUrl();
- sb.append(url == null ? "no url defined" : url);
- sb.append(")");
+ sb.append( url == null ? "no url defined" : url );
+ sb.append( ")" );
return sb.toString();
}
- public static Comparator<MavenProject> getProjectComparator() {
- if (projectComparator == null) {
- projectComparator = new Comparator<MavenProject>() {
+ public static Comparator<MavenProject> getProjectComparator()
+ {
+ if ( projectComparator == null )
+ {
+ projectComparator = new Comparator<MavenProject>()
+ {
@Override
- public int compare(MavenProject o1, MavenProject o2) {
+ public int compare( MavenProject o1, MavenProject o2 )
+ {
- String id1 = getArtifactId(o1.getArtifact());
- String id2 = getArtifactId(o2.getArtifact());
- return id1.compareTo(id2);
+ String id1 = getArtifactId( o1.getArtifact() );
+ String id2 = getArtifactId( o2.getArtifact() );
+ return id1.compareTo( id2 );
}
};
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/CommentStyleListMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -44,7 +44,9 @@
* @goal comment-style-list
* @since 2.1
*/
-public class CommentStyleListMojo extends AbstractLicenseMojo {
+public class CommentStyleListMojo
+ extends AbstractLicenseMojo
+{
/**
* A flag to display also the content of each license.
@@ -63,68 +65,78 @@
private Map<String, FileHeaderTransformer> transformers;
@Override
- protected void init() throws Exception {
+ protected void init()
+ throws Exception
+ {
//nothing to do
}
@Override
- public void doAction() throws MojoExecutionException, MojoFailureException {
+ public void doAction()
+ throws MojoExecutionException, MojoFailureException
+ {
StringBuilder buffer = new StringBuilder();
- if (isVerbose()) {
- 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" );
}
- List<String> names = new ArrayList<String>(transformers.keySet());
- Collections.sort(names);
+ List<String> names = new ArrayList<String>( transformers.keySet() );
+ Collections.sort( names );
int maxLength = 0;
int maxDLength = 0;
- for (String name : names) {
- if (name.length() > maxLength) {
+ for ( String name : names )
+ {
+ if ( name.length() > maxLength )
+ {
maxLength = name.length();
}
- FileHeaderTransformer transformer = transformers.get(name);
- if (transformer.getDescription().length() > maxDLength) {
+ FileHeaderTransformer transformer = transformers.get( name );
+ if ( transformer.getDescription().length() > maxDLength )
+ {
maxDLength = transformer.getDescription().length();
}
}
String pattern = " - %1$-" + maxLength + "s : %2$-" + maxDLength + "s, extensions : %3$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(),
- Arrays.toString(transformer.getDefaultAcceptedExtensions()))
- );
- if (detail) {
- buffer.append("\n example : \n");
- buffer.append(transformer.boxComment("header", true));
- buffer.append('\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(),
+ Arrays.toString( transformer.getDefaultAcceptedExtensions() ) ) );
+ if ( detail )
+ {
+ buffer.append( "\n example : \n" );
+ buffer.append( transformer.boxComment( "header", true ) );
+ buffer.append( '\n' );
}
}
- getLog().info(buffer.toString());
+ getLog().info( buffer.toString() );
}
- public boolean isDetail() {
+ public boolean isDetail()
+ {
return detail;
}
- public void setDetail(boolean detail) {
+ public void setDetail( boolean detail )
+ {
this.detail = detail;
}
- public Map<String, FileHeaderTransformer> getTransformers() {
+ public Map<String, FileHeaderTransformer> getTransformers()
+ {
return transformers;
}
- public void setTransformers(Map<String, FileHeaderTransformer> transformers) {
+ public void setTransformers( Map<String, FileHeaderTransformer> transformers )
+ {
this.transformers = transformers;
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/LicenseListMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -45,7 +45,10 @@
* @requiresDirectInvocation
* @since 1.0.1
*/
-public class LicenseListMojo extends AbstractLicenseMojo implements PluginWithEncoding {
+public class LicenseListMojo
+ extends AbstractLicenseMojo
+ implements PluginWithEncoding
+{
/**
* the url of an extra license repository.
@@ -75,82 +78,99 @@
*/
private String encoding;
- /** store of licenses */
+ /**
+ * store of licenses
+ */
protected LicenseStore licenseStore;
@Override
- protected void init() throws Exception {
+ protected void init()
+ throws Exception
+ {
// obtain licenses store
- licenseStore = createLicenseStore(extraResolver);
+ licenseStore = createLicenseStore( extraResolver );
}
@Override
- public void doAction() throws MojoExecutionException, MojoFailureException {
+ public void doAction()
+ throws MojoExecutionException, MojoFailureException
+ {
StringBuilder buffer = new StringBuilder();
- if (isVerbose()) {
- 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");
+ buffer.append( "Available licenses :\n\n" );
- List<String> names = Arrays.asList(licenseStore.getLicenseNames());
+ List<String> names = Arrays.asList( licenseStore.getLicenseNames() );
int maxLength = 0;
- for (String name : names) {
- if (name.length() > maxLength) {
+ for ( String name : names )
+ {
+ if ( name.length() > maxLength )
+ {
maxLength = name.length();
}
}
- Collections.sort(names);
+ 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");
- buffer.append(license.getHeaderContent(getEncoding()));
- buffer.append("\n\n");
- } catch (IOException ex) {
+ for ( String licenseName : names )
+ {
+ License license = licenseStore.getLicense( licenseName );
+ buffer.append( String.format( pattern, licenseName, license.getDescription() ) );
+ if ( detail )
+ {
+ try
+ {
+ buffer.append( "\n" );
+ buffer.append( license.getHeaderContent( getEncoding() ) );
+ buffer.append( "\n\n" );
+ }
+ catch ( IOException ex )
+ {
throw new MojoExecutionException(
- "could not instanciate license with name " +
- licenseName + " for reason " + ex.getMessage(), ex);
+ "could not instanciate license with name " + licenseName + " for reason " + ex.getMessage(),
+ ex );
}
}
}
- getLog().info(buffer.toString());
+ getLog().info( buffer.toString() );
}
@Override
- public final String getEncoding() {
+ public final String getEncoding()
+ {
return encoding;
}
@Override
- public final void setEncoding(String encoding) {
+ public final void setEncoding( String encoding )
+ {
this.encoding = encoding;
}
- public String getExtraResolver() {
+ public String getExtraResolver()
+ {
return extraResolver;
}
- public void setExtraResolver(String extraResolver) {
+ public void setExtraResolver( String extraResolver )
+ {
this.extraResolver = extraResolver;
}
- public boolean isDetail() {
+ public boolean isDetail()
+ {
return detail;
}
- public void setDetail(boolean detail) {
+ public void setDetail( boolean detail )
+ {
this.detail = detail;
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/LicenseMap.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/LicenseMap.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/LicenseMap.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -53,7 +53,9 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.3
*/
-public class LicenseMap extends TreeMap<String, SortedSet<MavenProject>> {
+public class LicenseMap
+ extends TreeMap<String, SortedSet<MavenProject>>
+{
private static final long serialVersionUID = 864199843545688069L;
@@ -61,38 +63,46 @@
public static final String unknownLicenseMessage = "Unknown license";
- public LicenseMap() {
+ public LicenseMap()
+ {
}
- public void setLog(Log log) {
+ public void setLog( Log log )
+ {
this.log = log;
}
- public Log getLog() {
+ public Log getLog()
+ {
return log;
}
- public void addLicense(MavenProject project,
- List<?> licenses) throws ProjectBuildingException {
+ public void addLicense( MavenProject project, List<?> licenses )
+ throws ProjectBuildingException
+ {
- if (Artifact.SCOPE_SYSTEM.equals(project.getArtifact().getScope())) {
+ if ( Artifact.SCOPE_SYSTEM.equals( project.getArtifact().getScope() ) )
+ {
// do NOT treate system dependency
return;
}
- if (CollectionUtils.isEmpty(licenses)) {
+ if ( CollectionUtils.isEmpty( licenses ) )
+ {
// no license found for the dependency
- put(getUnknownLicenseMessage(), project);
+ put( getUnknownLicenseMessage(), project );
return;
}
- for (Object o : licenses) {
+ for ( Object o : licenses )
+ {
String id;
- id = ArtifactHelper.getArtifactId(project.getArtifact());
- if (o == null) {
- getLog().warn("could not acquire the license for " + id);
+ id = ArtifactHelper.getArtifactId( project.getArtifact() );
+ if ( o == null )
+ {
+ getLog().warn( "could not acquire the license for " + id );
continue;
}
License license = (License) o;
@@ -100,34 +110,42 @@
// tchemit 2010-08-29 Ano #816 Check if the License object is well formed
- if (StringUtils.isEmpty(license.getName())) {
- getLog().warn("No license name defined for " + id);
+ if ( StringUtils.isEmpty( license.getName() ) )
+ {
+ getLog().warn( "No license name defined for " + id );
licenseKey = license.getUrl();
}
- if (StringUtils.isEmpty(licenseKey)) {
- getLog().warn("No license url defined for " + id);
+ if ( StringUtils.isEmpty( licenseKey ) )
+ {
+ getLog().warn( "No license url defined for " + id );
licenseKey = getUnknownLicenseMessage();
}
- put(licenseKey, project);
+ put( licenseKey, project );
}
}
- public SortedSet<MavenProject> getUnsafeDependencies() {
+ public SortedSet<MavenProject> getUnsafeDependencies()
+ {
Log log = getLog();
// get unsafe dependencies (says with no license)
- SortedSet<MavenProject> unsafeDependencies = get(getUnknownLicenseMessage());
+ SortedSet<MavenProject> unsafeDependencies = get( getUnknownLicenseMessage() );
- if (log.isDebugEnabled()) {
- if (CollectionUtils.isEmpty(unsafeDependencies)) {
- log.debug("There is no dependency with no license from poms.");
- } else {
- log.debug("There is " + unsafeDependencies.size() + " dependencies with no license from poms : ");
- for (MavenProject dep : unsafeDependencies) {
+ if ( log.isDebugEnabled() )
+ {
+ if ( CollectionUtils.isEmpty( unsafeDependencies ) )
+ {
+ log.debug( "There is no dependency with no license from poms." );
+ }
+ else
+ {
+ log.debug( "There is " + unsafeDependencies.size() + " dependencies with no license from poms : " );
+ for ( MavenProject dep : unsafeDependencies )
+ {
// no license found for the dependency
- log.debug(" - " + ArtifactHelper.getArtifactId(dep.getArtifact()));
+ log.debug( " - " + ArtifactHelper.getArtifactId( dep.getArtifact() ) );
}
}
}
@@ -135,21 +153,22 @@
return unsafeDependencies;
}
- protected SortedProperties loadUnsafeMapping(String encoding,
- File missingFile) throws IOException, ProjectBuildingException {
+ protected SortedProperties loadUnsafeMapping( String encoding, File missingFile )
+ throws IOException, ProjectBuildingException
+ {
-
SortedSet<MavenProject> unsafeDependencies = getUnsafeDependencies();
- SortedProperties unsafeMappings = new SortedProperties(encoding);
+ SortedProperties unsafeMappings = new SortedProperties( encoding );
// there is some unsafe dependencies
- if (missingFile.exists()) {
+ if ( missingFile.exists() )
+ {
- getLog().info("Load missing file " + missingFile);
+ getLog().info( "Load missing file " + missingFile );
// load the missing file
- unsafeMappings.load(missingFile);
+ unsafeMappings.load( missingFile );
}
// get from the missing file, all unknown dependencies
@@ -158,66 +177,76 @@
// migrate unsafe mapping (before version 3.0 we do not have the type of
// dependency in the missing file, now we must deal with it, so check it
-
List<String> migrateId = new ArrayList<String>();
- SortedMap<String, MavenProject> artifactCache =
- AbstractAddThirdPartyMojo.getArtifactCache();
- for (Object o : unsafeMappings.keySet()) {
+ SortedMap<String, MavenProject> artifactCache = AbstractAddThirdPartyMojo.getArtifactCache();
+ for ( Object o : unsafeMappings.keySet() )
+ {
String id = (String) o;
- MavenProject project = artifactCache.get(id);
- if (project == null) {
+ MavenProject project = artifactCache.get( id );
+ if ( project == null )
+ {
// try with the --jar type
- project = artifactCache.get(id + "--jar");
- if (project == null) {
+ project = artifactCache.get( id + "--jar" );
+ if ( project == null )
+ {
// now we are sure this is a unknown dependency
- unknownDependenciesId.add(id);
+ unknownDependenciesId.add( id );
- } else {
+ }
+ else
+ {
// this dependency must be migrated
- migrateId.add(id);
+ migrateId.add( id );
}
}
}
- if (!unknownDependenciesId.isEmpty()) {
+ if ( !unknownDependenciesId.isEmpty() )
+ {
// there is some unknown dependencies in the missing file, remove them
- for (String id : unknownDependenciesId) {
- getLog().warn("dependency [" + id + "] does not exists in project, remove it from the missing file.");
- unsafeMappings.remove(id);
+ for ( String id : unknownDependenciesId )
+ {
+ getLog().warn( "dependency [" + id + "] does not exists in project, remove it from the missing file." );
+ unsafeMappings.remove( id );
}
unknownDependenciesId.clear();
}
- if (!migrateId.isEmpty()) {
+ if ( !migrateId.isEmpty() )
+ {
// there is some dependencies to migrate in the missing file
- for (String id : migrateId) {
+ for ( String id : migrateId )
+ {
String newId = id + "--jar";
- getLog().info("Migrate " + id + " to " + newId + " in the missing file.");
- Object value = unsafeMappings.get(id);
- unsafeMappings.remove(id);
- unsafeMappings.put(newId, value);
+ getLog().info( "Migrate " + id + " to " + newId + " in the missing file." );
+ Object value = unsafeMappings.get( id );
+ unsafeMappings.remove( id );
+ unsafeMappings.put( newId, value );
}
migrateId.clear();
}
// push back loaded dependencies
- for (Object o : unsafeMappings.keySet()) {
+ for ( Object o : unsafeMappings.keySet() )
+ {
String id = (String) o;
- MavenProject project = artifactCache.get(id);
- if (project == null) {
- getLog().warn("dependency [" + id + "] does not exists in project.");
+ MavenProject project = artifactCache.get( id );
+ if ( project == null )
+ {
+ getLog().warn( "dependency [" + id + "] does not exists in project." );
continue;
}
- String license = (String) unsafeMappings.get(id);
- if (StringUtils.isEmpty(license)) {
+ String license = (String) unsafeMappings.get( id );
+ if ( StringUtils.isEmpty( license ) )
+ {
// empty license means not fill, skip it
continue;
@@ -225,102 +254,120 @@
// add license in map
License l = new License();
- l.setName(license.trim());
- l.setUrl(license.trim());
+ l.setName( license.trim() );
+ l.setUrl( license.trim() );
// add license
- addLicense(project, Arrays.asList(l));
+ addLicense( project, Arrays.asList( l ) );
// remove unknown license
- unsafeDependencies.remove(project);
+ unsafeDependencies.remove( project );
}
- if (unsafeDependencies.isEmpty()) {
+ if ( unsafeDependencies.isEmpty() )
+ {
// no more unknown license in map
- remove(getUnknownLicenseMessage());
- } else {
+ remove( getUnknownLicenseMessage() );
+ }
+ else
+ {
// add a "with no value license" for missing dependencies
- for (MavenProject project : unsafeDependencies) {
- String id = ArtifactHelper.getArtifactId(project.getArtifact());
- unsafeMappings.setProperty(id, "");
+ for ( MavenProject project : unsafeDependencies )
+ {
+ String id = ArtifactHelper.getArtifactId( project.getArtifact() );
+ unsafeMappings.setProperty( id, "" );
}
}
return unsafeMappings;
}
- public SortedSet<MavenProject> put(String key, MavenProject value) {
+ public SortedSet<MavenProject> put( String key, MavenProject value )
+ {
// handle multiple values as a set to avoid duplicates
- SortedSet<MavenProject> valueList = get(key);
- if (valueList == null) {
+ SortedSet<MavenProject> valueList = get( key );
+ if ( valueList == null )
+ {
- valueList = new TreeSet<MavenProject>(ArtifactHelper.getProjectComparator());
+ valueList = new TreeSet<MavenProject>( ArtifactHelper.getProjectComparator() );
}
- if (getLog().isDebugEnabled()) {
- getLog().debug("key:" + key + ",value: " + value);
+ if ( getLog().isDebugEnabled() )
+ {
+ getLog().debug( "key:" + key + ",value: " + value );
}
- valueList.add(value);
- return put(key, valueList);
+ valueList.add( value );
+ return put( key, valueList );
}
- public SortedMap<MavenProject, String[]> toDependencyMap() {
+ public SortedMap<MavenProject, String[]> toDependencyMap()
+ {
SortedMap<MavenProject, Set<String>> tmp =
- new TreeMap<MavenProject, Set<String>>(ArtifactHelper.getProjectComparator());
+ new TreeMap<MavenProject, Set<String>>( ArtifactHelper.getProjectComparator() );
- for (Map.Entry<String, SortedSet<MavenProject>> entry : entrySet()) {
+ for ( Map.Entry<String, SortedSet<MavenProject>> entry : entrySet() )
+ {
String license = entry.getKey();
SortedSet<MavenProject> set = entry.getValue();
- for (MavenProject p : set) {
- Set<String> list = tmp.get(p);
- if (list == null) {
+ for ( MavenProject p : set )
+ {
+ Set<String> list = tmp.get( p );
+ if ( list == null )
+ {
list = new HashSet<String>();
- tmp.put(p, list);
+ tmp.put( p, list );
}
- list.add(license);
+ list.add( license );
}
}
SortedMap<MavenProject, String[]> result =
- new TreeMap<MavenProject, String[]>(ArtifactHelper.getProjectComparator());
- for (Map.Entry<MavenProject, Set<String>> entry : tmp.entrySet()) {
- List<String> value = new ArrayList<String>(entry.getValue());
- Collections.sort(value);
- result.put(entry.getKey(), value.toArray(new String[value.size()]));
+ new TreeMap<MavenProject, String[]>( ArtifactHelper.getProjectComparator() );
+ for ( Map.Entry<MavenProject, Set<String>> entry : tmp.entrySet() )
+ {
+ List<String> value = new ArrayList<String>( entry.getValue() );
+ Collections.sort( value );
+ result.put( entry.getKey(), value.toArray( new String[value.size()] ) );
}
tmp.clear();
return result;
}
- public static String getUnknownLicenseMessage() {
+ public static String getUnknownLicenseMessage()
+ {
return unknownLicenseMessage;
}
- public void mergeLicenses(String... licenses) {
- if (licenses.length == 0) {
+ public void mergeLicenses( String... licenses )
+ {
+ if ( licenses.length == 0 )
+ {
return;
}
String mainLicense = licenses[0].trim();
- SortedSet<MavenProject> mainSet = get(mainLicense);
- if (mainSet == null) {
- getLog().warn("No license [" + mainLicense + "] found, will create it.");
- mainSet = new TreeSet<MavenProject>(ArtifactHelper.getProjectComparator());
- put(mainLicense, mainSet);
+ SortedSet<MavenProject> mainSet = get( mainLicense );
+ if ( mainSet == null )
+ {
+ getLog().warn( "No license [" + mainLicense + "] found, will create it." );
+ mainSet = new TreeSet<MavenProject>( ArtifactHelper.getProjectComparator() );
+ put( mainLicense, mainSet );
}
int size = licenses.length;
- for (int i = 1; i < size; i++) {
+ for ( int i = 1; i < size; i++ )
+ {
String license = licenses[i].trim();
- SortedSet<MavenProject> set = get(license);
- if (set == null) {
- getLog().warn("No license [" + license + "] found, skip this merge.");
+ SortedSet<MavenProject> set = get( license );
+ if ( set == null )
+ {
+ getLog().warn( "No license [" + license + "] found, skip this merge." );
continue;
}
- getLog().info("Merge license [" + license + "] (" + set.size() + " depedencies).");
- mainSet.addAll(set);
+ getLog().info( "Merge license [" + license + "] (" + set.size() + " depedencies)." );
+ mainSet.addAll( set );
set.clear();
- remove(license);
+ remove( license );
}
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/UpdateFileHeaderMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -64,7 +64,10 @@
* @goal update-file-header
* @since 2.1
*/
-public class UpdateFileHeaderMojo extends AbstractLicenseNameMojo implements FileHeaderProcessorConfiguration {
+public class UpdateFileHeaderMojo
+ extends AbstractLicenseNameMojo
+ implements FileHeaderProcessorConfiguration
+{
/**
* Name of project (or module).
@@ -277,13 +280,19 @@
*/
private Map<String, FileHeaderTransformer> transformers;
- /** internal file header transformer. */
+ /**
+ * internal file header transformer.
+ */
private FileHeaderTransformer transformer;
- /** internal default file header. */
+ /**
+ * internal default file header.
+ */
private FileHeader header;
- /** timestamp used for generation. */
+ /**
+ * timestamp used for generation.
+ */
private long timestamp;
/**
@@ -293,19 +302,15 @@
*/
private Map<String, String> extensionToCommentStyle;
- public static final String[] DEFAULT_INCLUDES = new String[]{"**/*"};
+ public static final String[] DEFAULT_INCLUDES = new String[]{ "**/*" };
- public static final String[] DEFAULT_EXCLUDES = new String[]{
- "**/*.zargo", "**/*.uml", "**/*.umldi", "**/*.xmi", /* modelisation */
+ public static final String[] DEFAULT_EXCLUDES =
+ new String[]{ "**/*.zargo", "**/*.uml", "**/*.umldi", "**/*.xmi", /* modelisation */
"**/*.img", "**/*.png", "**/*.jpg", "**/*.jpeg", "**/*.gif", /* images */
- "**/*.zip"
- };
+ "**/*.zip" };
- public static final String[] DEFAULT_ROOTS = new String[]{
- "src",
- "target/generated-sources",
- "target/processed-sources"
- };
+ public static final String[] DEFAULT_ROOTS =
+ new String[]{ "src", "target/generated-sources", "target/processed-sources" };
/**
* Defines state of a file after process.
@@ -313,21 +318,32 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
- enum FileState {
+ enum FileState
+ {
- /** file was updated */
+ /**
+ * file was updated
+ */
update,
- /** file was up to date */
+ /**
+ * file was up to date
+ */
uptodate,
- /** something was added on file */
+ /**
+ * something was added on file
+ */
add,
- /** file was ignored */
+ /**
+ * file was ignored
+ */
ignore,
- /** treatment failed for file */
+ /**
+ * treatment failed for file
+ */
fail;
/**
@@ -336,60 +352,70 @@
* @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) {
+ 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);
+ result.put( this, fileSet );
}
- fileSet.add(file);
+ fileSet.add( file );
}
}
- /** set of processed files */
+ /**
+ * set of processed files
+ */
private Set<File> processedFiles;
- /** Dictionnary of treated files indexed by their state. */
+ /**
+ * Dictionnary of treated files indexed by their state.
+ */
private EnumMap<FileState, Set<File>> result;
- /** Dictonnary of files to treate indexed by their CommentStyle. */
+ /**
+ * Dictonnary of files to treate indexed by their CommentStyle.
+ */
private Map<String, List<File>> filesToTreateByCommentStyle;
@Override
- public void init() throws Exception {
+ public void init()
+ throws Exception
+ {
- if (isSkip()) {
+ if ( isSkip() )
+ {
return;
}
- if (StringUtils.isEmpty(getIgnoreTag())) {
+ if ( StringUtils.isEmpty( getIgnoreTag() ) )
+ {
// use default value
- setIgnoreTag("%" + "%Ignore-License");
+ setIgnoreTag( "%" + "%Ignore-License" );
}
- if (isVerbose()) {
+ if ( isVerbose() )
+ {
// print availables comment styles (transformers)
StringBuilder buffer = new StringBuilder();
- buffer.append("config - available comment styles :");
+ 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);
+ 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());
+ getLog().info( buffer.toString() );
}
- if (isUpdateCopyright()) {
+ if ( isUpdateCopyright() )
+ {
- getLog().warn("\n\nupdateCopyright is not still available...\n\n");
+ getLog().warn( "\n\nupdateCopyright is not still available...\n\n" );
//TODO-TC20100409 checks scm
// checks scm is ok
// for the moment, will only deal with svn except if scm
@@ -398,83 +424,89 @@
}
// set timestamp used for temporary files
- setTimestamp(System.nanoTime());
+ setTimestamp( System.nanoTime() );
// add flags to authorize or not updates of header
- getFilter().setUpdateCopyright(isCanUpdateCopyright());
- getFilter().setUpdateDescription(isCanUpdateDescription());
- getFilter().setUpdateLicense(isCanUpdateLicense());
+ getFilter().setUpdateCopyright( isCanUpdateCopyright() );
+ getFilter().setUpdateDescription( isCanUpdateDescription() );
+ getFilter().setUpdateLicense( isCanUpdateLicense() );
- getFilter().setLog(getLog());
- getProcessor().setConfiguration(this);
- getProcessor().setFilter(filter);
+ getFilter().setLog( getLog() );
+ getProcessor().setConfiguration( this );
+ getProcessor().setFilter( filter );
super.init();
- if (roots == null || roots.length == 0) {
+ if ( roots == null || roots.length == 0 )
+ {
roots = DEFAULT_ROOTS;
- if (isVerbose()) {
- getLog().info("Will use default roots " +
- Arrays.toString(roots));
+ if ( isVerbose() )
+ {
+ getLog().info( "Will use default roots " + Arrays.toString( roots ) );
}
}
- if (includes == null || includes.length == 0) {
+ if ( includes == null || includes.length == 0 )
+ {
includes = DEFAULT_INCLUDES;
- if (isVerbose()) {
- getLog().info("Will use default includes " +
- Arrays.toString(includes));
+ if ( isVerbose() )
+ {
+ getLog().info( "Will use default includes " + Arrays.toString( includes ) );
}
}
- if (excludes == null || excludes.length == 0) {
+ if ( excludes == null || excludes.length == 0 )
+ {
excludes = DEFAULT_EXCLUDES;
- if (isVerbose()) {
- getLog().info("Will use default excludes" +
- Arrays.toString(excludes));
+ if ( isVerbose() )
+ {
+ getLog().info( "Will use default excludes" + Arrays.toString( excludes ) );
}
}
extensionToCommentStyle = new TreeMap<String, String>();
// add default extensions from header transformers
- for (Map.Entry<String, FileHeaderTransformer> entry : transformers.entrySet()) {
+ for ( Map.Entry<String, FileHeaderTransformer> entry : transformers.entrySet() )
+ {
String commentStyle = entry.getKey();
FileHeaderTransformer transformer = entry.getValue();
String[] extensions = transformer.getDefaultAcceptedExtensions();
- for (String extension : extensions) {
- if (isVerbose()) {
- getLog().info("Associate extension " + extension +
- " to comment style " + commentStyle);
+ for ( String extension : extensions )
+ {
+ if ( isVerbose() )
+ {
+ getLog().info( "Associate extension " + extension + " to comment style " + commentStyle );
}
- extensionToCommentStyle.put(extension, commentStyle);
+ extensionToCommentStyle.put( extension, commentStyle );
}
}
- if (extraExtensions != null) {
+ if ( extraExtensions != null )
+ {
// fill extra extensions for each transformer
- for (Map.Entry<String, String> entry : extraExtensions.entrySet()) {
+ for ( Map.Entry<String, String> entry : extraExtensions.entrySet() )
+ {
String extension = entry.getKey();
- if (extensionToCommentStyle.containsKey(extension)) {
+ if ( extensionToCommentStyle.containsKey( extension ) )
+ {
// override existing extension mapping
- getLog().warn("The extension " + extension +
- " is already accepted for comment style " +
- extensionToCommentStyle.get(extension));
+ getLog().warn( "The extension " + extension + " is already accepted for comment style " +
+ extensionToCommentStyle.get( extension ) );
}
String commentStyle = entry.getValue();
// check transformer exists
- getTransformer(commentStyle);
+ getTransformer( commentStyle );
- if (isVerbose()) {
- getLog().info("Associate extension '" + extension +
- "' to comment style '" + commentStyle +
- "'");
+ if ( isVerbose() )
+ {
+ getLog().info( "Associate extension '" + extension + "' to comment style '" + commentStyle + "'" );
}
- extensionToCommentStyle.put(extension, commentStyle);
+ extensionToCommentStyle.put( extension, commentStyle );
}
}
@@ -482,191 +514,217 @@
filesToTreateByCommentStyle = obtainFilesToTreateByCommentStyle();
}
- protected Map<String, List<File>> obtainFilesToTreateByCommentStyle() {
+ protected Map<String, List<File>> obtainFilesToTreateByCommentStyle()
+ {
Map<String, List<File>> result = new HashMap<String, List<File>>();
// add for all known comment style (says transformer) a empty list
// this permits not to have to test if there is an already list each time
// we wants to add a new file...
- for (String commentStyle : transformers.keySet()) {
- result.put(commentStyle, new ArrayList<File>());
+ for ( String commentStyle : transformers.keySet() )
+ {
+ result.put( commentStyle, new ArrayList<File>() );
}
- List<String> rootsList = new ArrayList<String>(roots.length);
- for (String root : roots) {
- File f = new File(root);
- if (f.isAbsolute()) {
- rootsList.add(f.getAbsolutePath());
- } else {
- f = new File(getProject().getBasedir(), root);
+ List<String> rootsList = new ArrayList<String>( roots.length );
+ for ( String root : roots )
+ {
+ File f = new File( root );
+ if ( f.isAbsolute() )
+ {
+ rootsList.add( f.getAbsolutePath() );
}
- if (f.exists()) {
- getLog().info("Will search files to update from root " + f);
- rootsList.add(f.getAbsolutePath());
- } else {
- if (isVerbose()) {
- getLog().info("Skip not found root " + f);
+ else
+ {
+ f = new File( getProject().getBasedir(), root );
+ }
+ if ( f.exists() )
+ {
+ getLog().info( "Will search files to update from root " + f );
+ rootsList.add( f.getAbsolutePath() );
+ }
+ else
+ {
+ if ( isVerbose() )
+ {
+ getLog().info( "Skip not found root " + f );
}
}
}
// Obtain all files to treate
Map<File, String[]> allFiles = new HashMap<File, String[]>();
- getFilesToTreateForRoots(includes, excludes, rootsList, allFiles, null);
+ getFilesToTreateForRoots( includes, excludes, rootsList, allFiles, null );
// filter all these files according to their extension
- for (Map.Entry<File, String[]> entry : allFiles.entrySet()) {
+ for ( Map.Entry<File, String[]> entry : allFiles.entrySet() )
+ {
File root = entry.getKey();
String[] filesPath = entry.getValue();
// sort them by the associated comment style to their extension
- for (String path : filesPath) {
- String extension = FileUtils.extension(path);
- String commentStyle = extensionToCommentStyle.get(extension);
- if (StringUtils.isEmpty(commentStyle)) {
+ for ( String path : filesPath )
+ {
+ String extension = FileUtils.extension( path );
+ String commentStyle = extensionToCommentStyle.get( extension );
+ if ( StringUtils.isEmpty( commentStyle ) )
+ {
// unknown extension, do not treate this file
continue;
}
//
- File file = new File(root, path);
- List<File> files = result.get(commentStyle);
- files.add(file);
+ File file = new File( root, path );
+ List<File> files = result.get( commentStyle );
+ files.add( file );
}
}
return result;
}
@Override
- public void doAction() throws Exception {
+ public void doAction()
+ throws Exception
+ {
long t0 = System.nanoTime();
clear();
processedFiles = new HashSet<File>();
- result = new EnumMap<FileState, Set<File>>(FileState.class);
+ result = new EnumMap<FileState, Set<File>>( FileState.class );
- try {
+ try
+ {
- for (Map.Entry<String, List<File>> commentStyleFiles :
- getFilesToTreateByCommentStyle().entrySet()) {
+ for ( Map.Entry<String, List<File>> commentStyleFiles : getFilesToTreateByCommentStyle().entrySet() )
+ {
String commentStyle = commentStyleFiles.getKey();
List<File> files = commentStyleFiles.getValue();
- processCommentStyle(commentStyle, files);
+ processCommentStyle( commentStyle, files );
}
- } finally {
+ }
+ finally
+ {
int nbFiles = getProcessedFiles().size();
- if (nbFiles == 0) {
- getLog().warn("No file to scan.");
- } else {
- String delay = PluginHelper.convertTime(System.nanoTime() - t0);
- String message = String.format(
- "Scan %s file%s header done in %s.",
- nbFiles,
- nbFiles > 1 ? "s" : "",
- delay
- );
- getLog().info(message);
+ if ( nbFiles == 0 )
+ {
+ getLog().warn( "No file to scan." );
}
+ else
+ {
+ String delay = PluginHelper.convertTime( System.nanoTime() - t0 );
+ String message =
+ String.format( "Scan %s file%s header done in %s.", nbFiles, nbFiles > 1 ? "s" : "", delay );
+ getLog().info( message );
+ }
Set<FileState> states = result.keySet();
- if (states.size() == 1 && states.contains(FileState.uptodate)) {
+ if ( states.size() == 1 && states.contains( FileState.uptodate ) )
+ {
// all files where up to date
- getLog().info("All files are up-to-date.");
- } else {
+ getLog().info( "All files are up-to-date." );
+ }
+ else
+ {
StringBuilder buffer = new StringBuilder();
- for (FileState state : FileState.values()) {
+ for ( FileState state : FileState.values() )
+ {
- reportType(state, buffer);
+ reportType( state, buffer );
}
- getLog().info(buffer.toString());
+ getLog().info( buffer.toString() );
}
// clean internal states
- if (isClearAfterOperation()) {
+ if ( isClearAfterOperation() )
+ {
clear();
}
}
}
- protected void processCommentStyle(String commentStyle,
- List<File> filesToTreat) throws IOException {
+ protected void processCommentStyle( String commentStyle, List<File> filesToTreat )
+ throws IOException
+ {
// obtain license from definition
String licenseName = getLicenseName();
- License license = getLicense(licenseName);
+ License license = getLicense( licenseName );
- getLog().info("Process header '" + commentStyle + "'");
- getLog().info(" - using " + license.getDescription());
+ getLog().info( "Process header '" + commentStyle + "'" );
+ getLog().info( " - using " + license.getDescription() );
// use header transformer according to comment style given in header
- setTransformer(getTransformer(commentStyle));
+ setTransformer( getTransformer( commentStyle ) );
// file header to use if no header is found on a file
- FileHeader defaultFileHeader = buildDefaultFileHeader(
- license,
- getProjectName(),
- getInceptionYear(),
- getOrganizationName(),
- isAddSvnKeyWords(),
- getEncoding()
- );
+ FileHeader defaultFileHeader =
+ buildDefaultFileHeader( license, getProjectName(), getInceptionYear(), getOrganizationName(),
+ isAddSvnKeyWords(), getEncoding() );
// change default license header in processor
- setHeader(defaultFileHeader);
+ setHeader( defaultFileHeader );
// update processor filter
getProcessor().populateFilter();
- for (File file : filesToTreat) {
- prepareProcessFile(file);
+ for ( File file : filesToTreat )
+ {
+ prepareProcessFile( file );
}
filesToTreat.clear();
}
- protected void prepareProcessFile(File file) throws IOException {
+ protected void prepareProcessFile( File file )
+ throws IOException
+ {
- if (getProcessedFiles().contains(file)) {
- getLog().info(" - skip already processed file " + file);
+ if ( getProcessedFiles().contains( file ) )
+ {
+ getLog().info( " - skip already processed file " + file );
return;
}
// output file
- File processFile =
- new File(file.getAbsolutePath() + "_" + getTimestamp());
+ 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());
+ 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 {
+ }
+ finally
+ {
// always clean processor internal states
getProcessor().reset();
// whatever was the result, this file is treated.
- getProcessedFiles().add(file);
+ getProcessedFiles().add( file );
- if (doFinalize) {
- finalizeFile(file, processFile);
- } else {
- deleteFile(processFile);
+ if ( doFinalize )
+ {
+ finalizeFile( file, processFile );
}
+ else
+ {
+ deleteFile( processFile );
+ }
}
}
@@ -680,35 +738,39 @@
* @return {@code true} if prepareProcessFile can be finalize, otherwise need to be delete
* @throws IOException if any pb while treatment
*/
- protected boolean processFile(File file,
- File processFile) throws IOException {
+ protected boolean processFile( File file, File processFile )
+ throws IOException
+ {
-
- if (getLog().isDebugEnabled()) {
- getLog().debug(" - process file " + file);
- getLog().debug(" - will process into file " + processFile);
+ if ( getLog().isDebugEnabled() )
+ {
+ getLog().debug( " - process file " + file );
+ getLog().debug( " - will process into file " + processFile );
}
String content;
- try {
+ try
+ {
// 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
- content = PluginHelper.readAsString(file, getEncoding());
+ content = PluginHelper.readAsString( file, getEncoding() );
- } catch (IOException e) {
- throw new IOException("Could not obtain content of file " + file);
}
+ catch ( IOException e )
+ {
+ throw new IOException( "Could not obtain content of file " + file );
+ }
//check that file is not marked to be ignored
- if (content.contains(getIgnoreTag())) {
- getLog().info(
- " - ignore file (detected " + getIgnoreTag() + ") " + file);
+ if ( content.contains( getIgnoreTag() ) )
+ {
+ getLog().info( " - ignore file (detected " + getIgnoreTag() + ") " + file );
- FileState.ignore.addFile(file, getResult());
+ FileState.ignore.addFile( file, getResult() );
return false;
}
@@ -717,151 +779,181 @@
// process file to detect header
- try {
- processor.process(file, processFile);
- } catch (IllegalStateException e) {
+ 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 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);
+ throw new IOException( "Could not process file " + file, e );
}
+ if ( processor.isTouched() )
+ {
- if (processor.isTouched()) {
-
- if (isVerbose()) {
- getLog().info(" - header was updated for " + file);
+ if ( isVerbose() )
+ {
+ getLog().info( " - header was updated for " + file );
}
- if (processor.isModified()) {
+ if ( processor.isModified() )
+ {
// header content has changed
// must copy back process file to file (if not dry run)
- FileState.update.addFile(file, getResult());
+ FileState.update.addFile( file, getResult() );
return true;
}
- FileState.uptodate.addFile(file, getResult());
+ FileState.uptodate.addFile( file, getResult() );
return false;
}
// header was not fully (or not at all) detected in file
- if (processor.isDetectHeader()) {
+ 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);
+ throw new InvalideFileHeaderException( "Could not find header end on file " + file );
}
// 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 tchemit 20100409 xml files must add header after a xml prolog line
- content = getTransformer().addHeader(
- getFilter().getFullHeaderContent(),
- content
- );
+ content = getTransformer().addHeader( getFilter().getFullHeaderContent(), content );
- if (!isDryRun()) {
- writeFile(processFile, content, getEncoding());
+ if ( !isDryRun() )
+ {
+ writeFile( processFile, content, getEncoding() );
}
- FileState.add.addFile(file, getResult());
+ FileState.add.addFile( file, getResult() );
return true;
}
- protected void finalizeFile(File file, File processFile) throws IOException {
+ protected void finalizeFile( File file, File processFile )
+ throws IOException
+ {
- if (isKeepBackup() && !isDryRun()) {
- File backupFile = getBackupFile(file);
+ if ( isKeepBackup() && !isDryRun() )
+ {
+ File backupFile = getBackupFile( file );
- if (backupFile.exists()) {
+ if ( backupFile.exists() )
+ {
// always delete backup file, before the renaming
- deleteFile(backupFile);
+ deleteFile( backupFile );
}
- if (isVerbose()) {
- getLog().debug(" - backup original file " + file);
+ if ( isVerbose() )
+ {
+ getLog().debug( " - backup original file " + file );
}
- renameFile(file, backupFile);
+ renameFile( file, backupFile );
}
- if (isDryRun()) {
+ if ( isDryRun() )
+ {
// dry run, delete temporary file
- deleteFile(processFile);
- } else {
+ deleteFile( processFile );
+ }
+ else
+ {
- try {
+ try
+ {
// replace file with the updated one
- renameFile(processFile, file);
- } catch (IOException e) {
+ renameFile( processFile, file );
+ }
+ catch ( IOException e )
+ {
// workaround windows problem to rename files
- getLog().warn(e.getMessage());
+ getLog().warn( e.getMessage() );
// try to copy content (fail on windows xp...)
- FileUtils.copyFile(processFile, file);
+ FileUtils.copyFile( processFile, file );
// then delete process file
- deleteFile(processFile);
+ deleteFile( processFile );
}
}
}
@Override
- protected void finalize() throws Throwable {
+ protected void finalize()
+ throws Throwable
+ {
super.finalize();
clear();
}
- protected void clear() {
+ protected void clear()
+ {
Set<File> files = getProcessedFiles();
- if (files != null) {
+ if ( files != null )
+ {
files.clear();
}
EnumMap<FileState, Set<File>> result = getResult();
- if (result != null) {
- for (Set<File> fileSet : result.values()) {
+ if ( result != null )
+ {
+ for ( Set<File> fileSet : result.values() )
+ {
fileSet.clear();
}
result.clear();
}
}
- protected void reportType(FileState state, StringBuilder buffer) {
+ 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(".");
+ 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.");
+ buffer.append( "\n * " ).append( operation ).append( " header on " );
+ buffer.append( set.size() );
+ if ( set.size() == 1 )
+ {
+ buffer.append( " file." );
}
- if (isVerbose()) {
- for (File file : set) {
- buffer.append("\n - ").append(file);
+ else
+ {
+ buffer.append( " files." );
+ }
+ if ( isVerbose() )
+ {
+ for ( File file : set )
+ {
+ buffer.append( "\n - " ).append( file );
}
}
}
@@ -878,264 +970,314 @@
* @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 {
+ 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) {
+ buffer.append( projectName );
+ if ( addSvnKeyWords )
+ {
// add svn keyworks
char ls = FileHeaderTransformer.LINE_SEPARATOR;
- buffer.append(ls);
+ buffer.append( ls );
// breaks the keyword otherwise svn will update them here
//TC-20100415 : do not generate thoses redundant keywords
// 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$");
+ buffer.append( ls ).append( "$" + "Id$" );
+ buffer.append( ls ).append( "$" + "HeadURL$" );
}
- result.setDescription(buffer.toString());
- if (getLog().isDebugEnabled()) {
- getLog().debug("header description : " + result.getDescription());
+ result.setDescription( buffer.toString() );
+ if ( getLog().isDebugEnabled() )
+ {
+ getLog().debug( "header description : " + result.getDescription() );
}
- String licenseContent = license.getHeaderContent(encoding);
- result.setLicense(licenseContent);
+ String licenseContent = license.getHeaderContent( encoding );
+ result.setLicense( licenseContent );
- Integer firstYear = Integer.valueOf(inceptionYear);
- result.setCopyrightFirstYear(firstYear);
+ 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);
+ cal.setTime( new Date() );
+ Integer lastYear = cal.get( Calendar.YEAR );
+ if ( firstYear < lastYear )
+ {
+ result.setCopyrightLastYear( lastYear );
}
- result.setCopyrightHolder(copyrightHolder);
+ result.setCopyrightHolder( copyrightHolder );
return result;
}
- public FileHeaderTransformer getTransformer(String transformerName)
- throws IllegalArgumentException, IllegalStateException {
- if (StringUtils.isEmpty(transformerName)) {
- throw new IllegalArgumentException(
- "transformerName can not be null, nor empty!");
+ 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!");
+ if ( transformers == null )
+ {
+ throw new IllegalStateException( "No transformers initialized!" );
}
- FileHeaderTransformer transformer =
- transformers.get(transformerName);
- if (transformer == null) {
+ FileHeaderTransformer transformer = transformers.get( transformerName );
+ if ( transformer == null )
+ {
throw new IllegalArgumentException(
- "transformerName " + transformerName + " is unknow, use one this one : " + transformers.keySet());
+ "transformerName " + transformerName + " is unknow, use one this one : " + transformers.keySet() );
}
return transformer;
}
- public boolean isClearAfterOperation() {
+ public boolean isClearAfterOperation()
+ {
return clearAfterOperation;
}
- public long getTimestamp() {
+ public long getTimestamp()
+ {
return timestamp;
}
- public String getProjectName() {
+ public String getProjectName()
+ {
return projectName;
}
- public String getInceptionYear() {
+ public String getInceptionYear()
+ {
return inceptionYear;
}
- public String getOrganizationName() {
+ public String getOrganizationName()
+ {
return organizationName;
}
- public boolean isUpdateCopyright() {
+ public boolean isUpdateCopyright()
+ {
return updateCopyright;
}
- public boolean isCanUpdateDescription() {
+ public boolean isCanUpdateDescription()
+ {
return canUpdateDescription;
}
- public boolean isCanUpdateCopyright() {
+ public boolean isCanUpdateCopyright()
+ {
return canUpdateCopyright;
}
- public boolean isCanUpdateLicense() {
+ public boolean isCanUpdateLicense()
+ {
return canUpdateLicense;
}
- public String getIgnoreTag() {
+ public String getIgnoreTag()
+ {
return ignoreTag;
}
- public boolean isDryRun() {
+ public boolean isDryRun()
+ {
return dryRun;
}
- public UpdateFileHeaderFilter getFilter() {
+ public UpdateFileHeaderFilter getFilter()
+ {
return filter;
}
@Override
- public FileHeader getFileHeader() {
+ public FileHeader getFileHeader()
+ {
return header;
}
@Override
- public FileHeaderTransformer getTransformer() {
+ public FileHeaderTransformer getTransformer()
+ {
return transformer;
}
@Override
- public boolean isSkip() {
+ public boolean isSkip()
+ {
return skipUpdateLicense;
}
- public Set<File> getProcessedFiles() {
+ public Set<File> getProcessedFiles()
+ {
return processedFiles;
}
- public EnumMap<FileState, Set<File>> getResult() {
+ public EnumMap<FileState, Set<File>> getResult()
+ {
return result;
}
- public Set<File> getFiles(FileState state) {
- return result.get(state);
+ public Set<File> getFiles( FileState state )
+ {
+ return result.get( state );
}
- public boolean isAddSvnKeyWords() {
+ public boolean isAddSvnKeyWords()
+ {
return addSvnKeyWords;
}
- public FileHeaderProcessor getProcessor() {
+ public FileHeaderProcessor getProcessor()
+ {
return processor;
}
- public Map<String, FileHeaderTransformer> getTransformers() {
+ public Map<String, FileHeaderTransformer> getTransformers()
+ {
return transformers;
}
- public Map<String, List<File>> getFilesToTreateByCommentStyle() {
+ public Map<String, List<File>> getFilesToTreateByCommentStyle()
+ {
return filesToTreateByCommentStyle;
}
@Override
- public void setSkip(boolean skipUpdateLicense) {
+ public void setSkip( boolean skipUpdateLicense )
+ {
this.skipUpdateLicense = skipUpdateLicense;
}
- public void setDryRun(boolean dryRun) {
+ public void setDryRun( boolean dryRun )
+ {
this.dryRun = dryRun;
}
- public void setTimestamp(long timestamp) {
+ public void setTimestamp( long timestamp )
+ {
this.timestamp = timestamp;
}
- public void setProjectName(String projectName) {
+ public void setProjectName( String projectName )
+ {
this.projectName = projectName;
}
- public void setSkipUpdateLicense(boolean skipUpdateLicense) {
+ public void setSkipUpdateLicense( boolean skipUpdateLicense )
+ {
this.skipUpdateLicense = skipUpdateLicense;
}
- public void setInceptionYear(String inceptionYear) {
+ public void setInceptionYear( String inceptionYear )
+ {
this.inceptionYear = inceptionYear;
}
- public void setOrganizationName(String organizationName) {
+ public void setOrganizationName( String organizationName )
+ {
this.organizationName = organizationName;
}
- public void setUpdateCopyright(boolean updateCopyright) {
+ public void setUpdateCopyright( boolean updateCopyright )
+ {
this.updateCopyright = updateCopyright;
}
- public void setIgnoreTag(String ignoreTag) {
+ public void setIgnoreTag( String ignoreTag )
+ {
this.ignoreTag = ignoreTag;
}
- public void setAddSvnKeyWords(boolean addSvnKeyWords) {
+ public void setAddSvnKeyWords( boolean addSvnKeyWords )
+ {
this.addSvnKeyWords = addSvnKeyWords;
}
- public void setClearAfterOperation(boolean clearAfterOperation) {
+ public void setClearAfterOperation( boolean clearAfterOperation )
+ {
this.clearAfterOperation = clearAfterOperation;
}
- public void setTransformer(FileHeaderTransformer transformer) {
+ public void setTransformer( FileHeaderTransformer transformer )
+ {
this.transformer = transformer;
}
- public void setHeader(FileHeader header) {
+ public void setHeader( FileHeader header )
+ {
this.header = header;
}
- public void setProcessor(FileHeaderProcessor processor) {
+ public void setProcessor( FileHeaderProcessor processor )
+ {
this.processor = processor;
}
- public void setFilter(UpdateFileHeaderFilter filter) {
+ public void setFilter( UpdateFileHeaderFilter filter )
+ {
this.filter = filter;
}
- public void setCanUpdateDescription(boolean canUpdateDescription) {
+ public void setCanUpdateDescription( boolean canUpdateDescription )
+ {
this.canUpdateDescription = canUpdateDescription;
}
- public void setCanUpdateCopyright(boolean canUpdateCopyright) {
+ public void setCanUpdateCopyright( boolean canUpdateCopyright )
+ {
this.canUpdateCopyright = canUpdateCopyright;
}
- public void setCanUpdateLicense(boolean canUpdateLicense) {
+ public void setCanUpdateLicense( boolean canUpdateLicense )
+ {
this.canUpdateLicense = canUpdateLicense;
}
- public void setTransformers(Map<String, FileHeaderTransformer> transformers) {
+ public void setTransformers( Map<String, FileHeaderTransformer> transformers )
+ {
this.transformers = transformers;
}
- public void setFilesToTreateByCommentStyle(Map<String, List<File>> filesToTreateByCommentStyle) {
+ public void setFilesToTreateByCommentStyle( Map<String, List<File>> filesToTreateByCommentStyle )
+ {
this.filesToTreateByCommentStyle = filesToTreateByCommentStyle;
}
- public void setRoots(String[] roots) {
+ public void setRoots( String[] roots )
+ {
this.roots = roots;
}
- public void setRoots(String roots) {
- this.roots = roots.split(",");
+ public void setRoots( String roots )
+ {
+ this.roots = roots.split( "," );
}
- public void setIncludes(String[] includes) {
+ public void setIncludes( String[] includes )
+ {
this.includes = includes;
}
- public void setIncludes(String includes) {
- this.includes = includes.split(",");
+ public void setIncludes( String includes )
+ {
+ this.includes = includes.split( "," );
}
- public void setExcludes(String[] excludes) {
+ public void setExcludes( String[] excludes )
+ {
this.excludes = excludes;
}
- public void setExcludes(String excludes) {
- this.excludes = excludes.split(",");
+ public void setExcludes( String excludes )
+ {
+ this.excludes = excludes.split( "," );
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/UpdateProjectLicenseMojo.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -47,7 +47,9 @@
* @requiresProject true
* @since 2.1
*/
-public class UpdateProjectLicenseMojo extends AbstractLicenseNameMojo {
+public class UpdateProjectLicenseMojo
+ extends AbstractLicenseNameMojo
+{
/**
* Project license file to synchronize with main license defined in
@@ -112,13 +114,18 @@
*/
protected boolean skipUpdateProjectLicense;
- /** flag to known if */
+ /**
+ * flag to known if
+ */
protected boolean doGenerate;
@Override
- protected void init() throws Exception {
+ protected void init()
+ throws Exception
+ {
- if (isSkip()) {
+ if ( isSkip() )
+ {
return;
}
@@ -126,122 +133,142 @@
// must generate if file does not exist or pom never thant license file
File licenseFile = getLicenseFile();
- if (licenseFile != null) {
- setDoGenerate(isForce() || !isFileNewerThanPomFile(licenseFile));
+ if ( licenseFile != null )
+ {
+ setDoGenerate( isForce() || !isFileNewerThanPomFile( licenseFile ) );
}
}
@Override
- protected void doAction() throws Exception {
+ protected void doAction()
+ throws Exception
+ {
License mainLicense = getMainLicense();
File target = getLicenseFile();
- if (isDoGenerate()) {
+ if ( isDoGenerate() )
+ {
- getLog().info("Will create or update license file [" +
- mainLicense.getName() + "] to " + target);
- if (isVerbose()) {
- getLog().info("detail of license :\n" + mainLicense);
+ 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);
+ if ( target.exists() && isKeepBackup() )
+ {
+ if ( isVerbose() )
+ {
+ getLog().info( "backup " + target );
}
// copy it to backup file
- backupFile(target);
+ backupFile( target );
}
}
// obtain license content
- String licenseContent = mainLicense.getLicenseContent(getEncoding());
+ String licenseContent = mainLicense.getLicenseContent( getEncoding() );
- if (isDoGenerate()) {
+ if ( isDoGenerate() )
+ {
// writes it root main license file
- writeFile(target, licenseContent, getEncoding());
+ writeFile( target, licenseContent, getEncoding() );
}
- if (hasClassPath()) {
+ if ( hasClassPath() )
+ {
// copy LICENSE.txt to the resource directory (to be include in
// class-path)
- File resourceTarget = new File(getOutputDirectory(), target.getName());
+ File resourceTarget = new File( getOutputDirectory(), target.getName() );
- copyFile(getLicenseFile(), resourceTarget);
+ copyFile( getLicenseFile(), resourceTarget );
- if (isGenerateBundle()) {
+ if ( isGenerateBundle() )
+ {
// creates the bundled license file
- File bundleTarget = PluginHelper.getFile(
- getOutputDirectory(),
- getBundleLicensePath()
- );
- copyFile(target, bundleTarget);
+ File bundleTarget = PluginHelper.getFile( getOutputDirectory(), getBundleLicensePath() );
+ copyFile( target, bundleTarget );
}
// add resources directory as project resources basedir
- addResourceDir(getOutputDirectory(), "**/*.txt");
+ addResourceDir( getOutputDirectory(), "**/*.txt" );
}
}
- public File getLicenseFile() {
+ public File getLicenseFile()
+ {
return licenseFile;
}
- public boolean isGenerateBundle() {
+ public boolean isGenerateBundle()
+ {
return generateBundle;
}
- public File getOutputDirectory() {
+ public File getOutputDirectory()
+ {
return outputDirectory;
}
- public String getBundleLicensePath() {
+ public String getBundleLicensePath()
+ {
return bundleLicensePath;
}
- public boolean isDoGenerate() {
+ public boolean isDoGenerate()
+ {
return doGenerate;
}
- public boolean isForce() {
+ public boolean isForce()
+ {
return force;
}
@Override
- public boolean isSkip() {
+ public boolean isSkip()
+ {
return skipUpdateProjectLicense;
}
- public void setLicenseFile(File licenseFile) {
+ public void setLicenseFile( File licenseFile )
+ {
this.licenseFile = licenseFile;
}
- public void setGenerateBundle(boolean generateBundle) {
+ public void setGenerateBundle( boolean generateBundle )
+ {
this.generateBundle = generateBundle;
}
- public void setOutputDirectory(File outputDirectory) {
+ public void setOutputDirectory( File outputDirectory )
+ {
this.outputDirectory = outputDirectory;
}
- public void setBundleLicensePath(String bundleLicensePath) {
+ public void setBundleLicensePath( String bundleLicensePath )
+ {
this.bundleLicensePath = bundleLicensePath;
}
- public void setDoGenerate(boolean doGenerate) {
+ public void setDoGenerate( boolean doGenerate )
+ {
this.doGenerate = doGenerate;
}
@Override
- public void setSkip(boolean skipUpdateProjectLicense) {
+ public void setSkip( boolean skipUpdateProjectLicense )
+ {
this.skipUpdateProjectLicense = skipUpdateProjectLicense;
}
- public void setForce(boolean force) {
+ public void setForce( boolean force )
+ {
this.force = force;
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeader.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -41,18 +41,27 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class FileHeader {
+public class FileHeader
+{
- /** Copyright to string format */
+ /**
+ * Copyright to string format
+ */
protected static final String COPYRIGHT_TO_STRING_FORMAT = "Copyright (C) %1$s %2$s";
- /** Description of the project or module to add in header */
+ /**
+ * Description of the project or module to add in header
+ */
protected String description;
- /** Copyright holder */
+ /**
+ * Copyright holder
+ */
protected String copyrightHolder;
- /** Copyright first year of application */
+ /**
+ * Copyright first year of application
+ */
protected Integer copyrightFirstYear;
/**
@@ -61,24 +70,33 @@
*/
protected Integer copyrightLastYear;
- /** License used in the header. */
+ /**
+ * License used in the header.
+ */
protected String license;
/**
* @return the project name, or nay other common informations for all
* files of a project (or module)
*/
- public String getDescription() {
+ public String getDescription()
+ {
return description;
}
- /** @return the copyright holder */
- public String getCopyrightHolder() {
+ /**
+ * @return the copyright holder
+ */
+ public String getCopyrightHolder()
+ {
return copyrightHolder;
}
- /** @return the first year of the copyright */
- public Integer getCopyrightFirstYear() {
+ /**
+ * @return the first year of the copyright
+ */
+ public Integer getCopyrightFirstYear()
+ {
return copyrightFirstYear;
}
@@ -86,7 +104,8 @@
* @return the last year of the copyright (if copyright affects only one
* year, can be equals to the {@link #getCopyrightFirstYear()}).
*/
- public Integer getCopyrightLastYear() {
+ public Integer getCopyrightLastYear()
+ {
return copyrightLastYear;
}
@@ -105,25 +124,22 @@
*
* @return the String representation of the copyright
*/
- public String getCopyright() {
+ public String getCopyright()
+ {
String copyright;
- if (getCopyrightLastYear() == null) {
+ if ( getCopyrightLastYear() == null )
+ {
// copyright on one year
- copyright = String.format(
- COPYRIGHT_TO_STRING_FORMAT,
- getCopyrightFirstYear(),
- getCopyrightHolder()
- );
- } else {
+ copyright = String.format( COPYRIGHT_TO_STRING_FORMAT, getCopyrightFirstYear(), getCopyrightHolder() );
+ }
+ else
+ {
// copyright on more than one year
- copyright = String.format(
- COPYRIGHT_TO_STRING_FORMAT,
- getCopyrightFirstYear() + " - " +
- getCopyrightLastYear(),
- getCopyrightHolder()
- );
+ copyright =
+ String.format( COPYRIGHT_TO_STRING_FORMAT, getCopyrightFirstYear() + " - " + getCopyrightLastYear(),
+ getCopyrightHolder() );
}
return copyright;
}
@@ -132,27 +148,33 @@
* @return the license content (this is not the fully license content,
* but just a per file license resume)
*/
- public String getLicense() {
+ public String getLicense()
+ {
return license;
}
- public void setDescription(String description) {
+ public void setDescription( String description )
+ {
this.description = description;
}
- public void setCopyrightHolder(String copyrightHolder) {
+ public void setCopyrightHolder( String copyrightHolder )
+ {
this.copyrightHolder = copyrightHolder;
}
- public void setCopyrightFirstYear(Integer copyrightFirstYear) {
+ public void setCopyrightFirstYear( Integer copyrightFirstYear )
+ {
this.copyrightFirstYear = copyrightFirstYear;
}
- public void setCopyrightLastYear(Integer copyrightLastYear) {
+ public void setCopyrightLastYear( Integer copyrightLastYear )
+ {
this.copyrightLastYear = copyrightLastYear;
}
- public void setLicense(String license) {
+ public void setLicense( String license )
+ {
this.license = license;
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderFilter.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -35,7 +35,9 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public abstract class FileHeaderFilter extends DefaultFilter {
+public abstract class FileHeaderFilter
+ extends DefaultFilter
+{
/**
* flag set to {@code true} when a header was detected (says detects both
@@ -43,28 +45,44 @@
*/
protected boolean touched;
- /** flag set to {@code true} when a header was detected and was modified. */
+ /**
+ * 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. */
+ /**
+ * flag set to {@code true} as soon as start process tag was detected.
+ */
protected boolean detectHeader;
- /** incoming default file header model */
+ /**
+ * incoming default file header model
+ */
protected FileHeader fileHeader;
- /** header transformer */
+ /**
+ * header transformer
+ */
protected FileHeaderTransformer transformer;
- /** cached header content */
+ /**
+ * cached header content
+ */
protected String headerContent;
- /** cached full header content (with process tag + comment box) */
+ /**
+ * cached full header content (with process tag + comment box)
+ */
protected String processTagHeaderContent;
- /** cached full header content (with process tag + comment box) */
+ /**
+ * cached full header content (with process tag + comment box)
+ */
protected String fullHeaderContent;
- /** maven logger */
+ /**
+ * maven logger
+ */
protected Log log;
/**
@@ -76,7 +94,7 @@
* @return {@code null} if header is still the same, otherwise the new header to apply
* @since 2.3.2
*/
- protected abstract FileHeader getNewHeader(FileHeader oldHeader);
+ protected abstract FileHeader getNewHeader( FileHeader oldHeader );
/**
* The logic to implements when a header was touched.
@@ -88,50 +106,59 @@
* @deprecated since 2.3.2, use now the method {@link #getNewHeader(FileHeader)}.
*/
@Deprecated
- protected abstract String treateHeader(String ch);
+ protected abstract String treateHeader( String ch );
- public FileHeaderFilter() {
+ public FileHeaderFilter()
+ {
}
- public Log getLog() {
+ public Log getLog()
+ {
return log;
}
- public void setLog(Log log) {
+ public void setLog( Log log )
+ {
this.log = log;
}
@Override
- protected String performInFilter(String ch) {
- if (log.isDebugEnabled()) {
- log.debug("performInFilter - original header =\n" + ch);
+ protected String performInFilter( String ch )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "performInFilter - original header =\n" + ch );
}
- if (isTouched()) {
+ if ( isTouched() )
+ {
// Can NOT authorize two header in a same source
- throw new IllegalStateException(
- "Can only have one file header start tag : " + getHeader());
+ throw new IllegalStateException( "Can only have one file header start tag : " + getHeader() );
}
- if (getMatchIndexFor(ch, getHeader()) == NOT_FOUND) {
+ if ( getMatchIndexFor( ch, getHeader() ) == NOT_FOUND )
+ {
// the header was detected, mark file to be touched
touched = true;
// obtain old header model
FileHeaderTransformer headerTransformer = getTransformer();
- String tmp = headerTransformer.unboxComent(ch);
- FileHeader oldHeader = headerTransformer.toFileHeader(tmp);
+ String tmp = headerTransformer.unboxComent( ch );
+ FileHeader oldHeader = headerTransformer.toFileHeader( tmp );
// obtain the new header (according to what to update)
- FileHeader newFileHeader = getNewHeader(oldHeader);
+ FileHeader newFileHeader = getNewHeader( oldHeader );
FileHeader header;
- if (newFileHeader == null) {
+ if ( newFileHeader == null )
+ {
// keep the old header
header = oldHeader;
- } else {
+ }
+ else
+ {
// mark that the header was updated
modified = true;
@@ -139,7 +166,7 @@
header = newFileHeader;
}
- String result = transformer.toHeaderContent(header);
+ String result = transformer.toHeaderContent( header );
return result;
// // update header
@@ -168,98 +195,115 @@
}
@Override
- protected String performOutFilter(String ch) {
- if (log.isDebugEnabled()) {
- log.debug(ch);
+ protected String performOutFilter( String ch )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( ch );
}
return ch;
}
@Override
- protected String getHeader() {
+ protected String getHeader()
+ {
return getTransformer().getProcessStartTag();
}
@Override
- protected String getFooter() {
+ protected String getFooter()
+ {
return getTransformer().getProcessEndTag();
}
@Override
- protected void changeState(State newState) {
- super.changeState(newState);
- if (newState == State.SEARCH_FOOTER) {
+ protected void changeState( State newState )
+ {
+ super.changeState( newState );
+ if ( newState == State.SEARCH_FOOTER )
+ {
// on a decouvert un header
detectHeader = true;
}
}
- public String getHeaderContent() {
- if (headerContent == null) {
- headerContent = getTransformer().toString(getFileHeader());
+ public String getHeaderContent()
+ {
+ if ( headerContent == null )
+ {
+ headerContent = getTransformer().toString( getFileHeader() );
}
return headerContent;
}
- public String getProcessTagHeaderContent() {
- if (processTagHeaderContent == null) {
+ public String getProcessTagHeaderContent()
+ {
+ if ( processTagHeaderContent == null )
+ {
// box with process tag
- processTagHeaderContent =
- getTransformer().boxProcessTag(getHeaderContent());
+ processTagHeaderContent = getTransformer().boxProcessTag( getHeaderContent() );
}
return processTagHeaderContent;
}
- public String getFullHeaderContent() {
- if (fullHeaderContent == null) {
+ public String getFullHeaderContent()
+ {
+ if ( fullHeaderContent == null )
+ {
// box with comment
- fullHeaderContent = getTransformer().boxComment(
- getProcessTagHeaderContent(),
- true
- );
+ fullHeaderContent = getTransformer().boxComment( getProcessTagHeaderContent(), true );
}
return fullHeaderContent;
}
- public boolean isTouched() {
+ public boolean isTouched()
+ {
return touched;
}
- public boolean isModified() {
+ public boolean isModified()
+ {
return modified;
}
- public boolean isDetectHeader() {
+ public boolean isDetectHeader()
+ {
return detectHeader;
}
- public FileHeader getFileHeader() {
+ public FileHeader getFileHeader()
+ {
return fileHeader;
}
- public FileHeaderTransformer getTransformer() {
+ public FileHeaderTransformer getTransformer()
+ {
return transformer;
}
- public void setFileHeader(FileHeader fileHeader) {
+ public void setFileHeader( FileHeader fileHeader )
+ {
this.fileHeader = fileHeader;
}
- public void setTransformer(FileHeaderTransformer transformer) {
+ public void setTransformer( FileHeaderTransformer transformer )
+ {
this.transformer = transformer;
}
- public void reset() {
+ public void reset()
+ {
touched = false;
modified = false;
detectHeader = false;
state = State.SEARCH_HEADER;
}
- public void resetContent() {
+ 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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessor.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -40,22 +40,31 @@
* @plexus.component role="org.nuiton.processor.Processor" role-hint="file-header"
* @since 2.1
*/
-public class FileHeaderProcessor extends Processor {
+public class FileHeaderProcessor
+ extends Processor
+{
- /** processor configuration */
+ /**
+ * processor configuration
+ */
protected FileHeaderProcessorConfiguration configuration;
- /** internal file header filter */
+ /**
+ * internal file header filter
+ */
protected FileHeaderFilter filter;
- public FileHeaderProcessor() {
+ public FileHeaderProcessor()
+ {
}
- public FileHeaderProcessorConfiguration getConfiguration() {
+ public FileHeaderProcessorConfiguration getConfiguration()
+ {
return configuration;
}
- public FileHeaderFilter getFilter() {
+ public FileHeaderFilter getFilter()
+ {
return filter;
}
@@ -64,7 +73,8 @@
* fully found), {@code false} otherwise
* @see FileHeaderFilter#isTouched()
*/
- public boolean isTouched() {
+ public boolean isTouched()
+ {
return getFilter() != null && getFilter().isTouched();
}
@@ -73,7 +83,8 @@
* fully found and content changed), {@code false} otherwise
* @see FileHeaderFilter#isModified()
*/
- public boolean isModified() {
+ public boolean isModified()
+ {
return getFilter() != null && getFilter().isModified();
}
@@ -81,91 +92,116 @@
* @return {@code true} if header of header was detected
* @see FileHeaderFilter#isDetectHeader()
*/
- public boolean isDetectHeader() {
+ public boolean isDetectHeader()
+ {
return getFilter() != null && getFilter().isDetectHeader();
}
- public void process(File filein, File fileout) throws IOException, IllegalStateException {
+ public void process( File filein, File fileout )
+ throws IOException, IllegalStateException
+ {
checkInit();
reset();
- FileReader input = new FileReader(filein);
- try {
- FileWriter output = new FileWriter(fileout);
- try {
- process(input, output);
- } finally {
+ FileReader input = new FileReader( filein );
+ try
+ {
+ FileWriter output = new FileWriter( fileout );
+ try
+ {
+ process( input, output );
+ }
+ finally
+ {
output.close();
}
- } finally {
+ }
+ finally
+ {
input.close();
}
}
- public void populateFilter() {
+ public void populateFilter()
+ {
FileHeader fileHeader = getConfiguration().getFileHeader();
boolean change = false;
FileHeaderFilter filter = getFilter();
- if (!fileHeader.equals(filter.getFileHeader())) {
+ if ( !fileHeader.equals( filter.getFileHeader() ) )
+ {
// change file header
- filter.setFileHeader(fileHeader);
+ filter.setFileHeader( fileHeader );
change = true;
}
FileHeaderTransformer transformer = getConfiguration().getTransformer();
- if (!transformer.equals(filter.getTransformer())) {
+ if ( !transformer.equals( filter.getTransformer() ) )
+ {
// change file transformer
- filter.setTransformer(transformer);
+ filter.setTransformer( transformer );
change = true;
}
- if (change) {
+ if ( change )
+ {
// something has changed, must reset content cache
filter.resetContent();
}
}
- public void setConfiguration(FileHeaderProcessorConfiguration configuration) {
+ public void setConfiguration( FileHeaderProcessorConfiguration configuration )
+ {
this.configuration = configuration;
}
- public void setFilter(FileHeaderFilter filter) {
+ public void setFilter( FileHeaderFilter filter )
+ {
this.filter = filter;
- setInputFilter(filter);
+ setInputFilter( filter );
}
- public void reset() {
- if (filter != null) {
+ public void reset()
+ {
+ if ( filter != null )
+ {
filter.reset();
}
}
- protected FileHeader getFileHeader() {
+ protected FileHeader getFileHeader()
+ {
return getConfiguration().getFileHeader();
}
- protected FileHeaderTransformer getTransformer() {
+ protected FileHeaderTransformer getTransformer()
+ {
return getConfiguration().getTransformer();
}
- protected void checkInit() throws IllegalStateException {
- if (getConfiguration() == null) {
- throw new IllegalStateException("no configuration set.");
+ 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 ( getFileHeader() == null )
+ {
+ throw new IllegalStateException( "no file header set." );
}
- if (getTransformer() == null) {
- throw new IllegalStateException("no file header transformer set.");
+ if ( getTransformer() == null )
+ {
+ throw new IllegalStateException( "no file header transformer set." );
}
- if (getFilter() == null) {
- throw new IllegalStateException("no file header filter set.");
+ if ( getFilter() == null )
+ {
+ throw new IllegalStateException( "no file header filter set." );
}
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessorConfiguration.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessorConfiguration.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/FileHeaderProcessorConfiguration.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -34,15 +34,22 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public interface FileHeaderProcessorConfiguration {
+public interface FileHeaderProcessorConfiguration
+{
- /** @return mojo logger */
+ /**
+ * @return mojo logger
+ */
Log getLog();
- /** @return the current file header to use */
+ /**
+ * @return the current file header to use
+ */
FileHeader getFileHeader();
- /** @return the current file transformer to use */
+ /**
+ * @return the current file transformer to use
+ */
FileHeaderTransformer getTransformer();
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/InvalideFileHeaderException.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/InvalideFileHeaderException.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/InvalideFileHeaderException.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -34,21 +34,27 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class InvalideFileHeaderException extends IOException {
+public class InvalideFileHeaderException
+ extends IOException
+{
private static final long serialVersionUID = 1L;
- public InvalideFileHeaderException() {
+ public InvalideFileHeaderException()
+ {
}
- public InvalideFileHeaderException(String message) {
- super(message);
+ public InvalideFileHeaderException( String message )
+ {
+ super( message );
}
- public InvalideFileHeaderException(String message, Throwable cause) {
- super(message, cause);
+ public InvalideFileHeaderException( String message, Throwable cause )
+ {
+ super( message, cause );
}
- public InvalideFileHeaderException(Throwable cause) {
- super(cause);
+ public InvalideFileHeaderException( Throwable cause )
+ {
+ super( cause );
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/header/UpdateFileHeaderFilter.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/header/UpdateFileHeaderFilter.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/UpdateFileHeaderFilter.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -34,7 +34,9 @@
* @plexus.component role="org.nuiton.license.plugin.header.FileHeaderFilter" role-hint="update-file-header"
* @since 2.1
*/
-public class UpdateFileHeaderFilter extends FileHeaderFilter {
+public class UpdateFileHeaderFilter
+ extends FileHeaderFilter
+{
/**
* Flag sets to {@code true} if description can be updated.
@@ -57,11 +59,13 @@
*/
protected boolean updateCopyright;
- public UpdateFileHeaderFilter() {
+ public UpdateFileHeaderFilter()
+ {
}
@Override
- protected FileHeader getNewHeader(FileHeader oldHeader) {
+ protected FileHeader getNewHeader( FileHeader oldHeader )
+ {
FileHeader result = new FileHeader();
@@ -72,64 +76,72 @@
boolean modified = false;
// by default, reuse the old header
- result.setDescription(oldHeader.getDescription());
- result.setCopyrightFirstYear(oldHeader.getCopyrightFirstYear());
- result.setCopyrightLastYear(oldHeader.getCopyrightLastYear());
- result.setCopyrightHolder(oldHeader.getCopyrightHolder());
- result.setLicense(oldHeader.getLicense());
+ result.setDescription( oldHeader.getDescription() );
+ result.setCopyrightFirstYear( oldHeader.getCopyrightFirstYear() );
+ result.setCopyrightLastYear( oldHeader.getCopyrightLastYear() );
+ result.setCopyrightHolder( oldHeader.getCopyrightHolder() );
+ result.setLicense( oldHeader.getLicense() );
- if (isUpdateDescription() &&
- !transformer.isDescriptionEquals(oldHeader, newHeader)) {
+ if ( isUpdateDescription() && !transformer.isDescriptionEquals( oldHeader, newHeader ) )
+ {
// can update description and it has changed
- if (log.isDebugEnabled()) {
- log.debug("description has changed from [" + oldHeader.getDescription() + "] to [" + newHeader.getDescription() + "]");
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "description has changed from [" + oldHeader.getDescription() + "] to [" +
+ newHeader.getDescription() + "]" );
}
// description has changed, mark header to be updated
modified = true;
// use the new description
- result.setDescription(newHeader.getDescription());
+ result.setDescription( newHeader.getDescription() );
}
- if (isUpdateCopyright() &&
- !transformer.isCopyrightEquals(oldHeader, newHeader)) {
+ if ( isUpdateCopyright() && !transformer.isCopyrightEquals( oldHeader, newHeader ) )
+ {
// can update copyright and it has changed
- if (log.isDebugEnabled()) {
- log.debug("copyright has changed from [" + oldHeader.getCopyright() + "] to [" + newHeader.getCopyright() + "]");
+ if ( log.isDebugEnabled() )
+ {
+ log.debug(
+ "copyright has changed from [" + oldHeader.getCopyright() + "] to [" + newHeader.getCopyright() +
+ "]" );
}
// description has changed, mark header to be updated
modified = true;
// use the new copyright
- result.setCopyrightFirstYear(result.getCopyrightFirstYear());
- result.setCopyrightLastYear(result.getCopyrightLastYear());
- result.setCopyrightHolder(result.getCopyrightHolder());
+ result.setCopyrightFirstYear( result.getCopyrightFirstYear() );
+ result.setCopyrightLastYear( result.getCopyrightLastYear() );
+ result.setCopyrightHolder( result.getCopyrightHolder() );
}
- if (isUpdateLicense() &&
- !transformer.isLicenseEquals(oldHeader, newHeader)) {
+ if ( isUpdateLicense() && !transformer.isLicenseEquals( oldHeader, newHeader ) )
+ {
// can update license and it has changed
- if (log.isDebugEnabled()) {
- log.debug("license has changed from [" + oldHeader.getLicense() + "] to [" + newHeader.getLicense() + "]");
+ if ( log.isDebugEnabled() )
+ {
+ log.debug(
+ "license has changed from [" + oldHeader.getLicense() + "] to [" + newHeader.getLicense() + "]" );
}
// description has changed, mark header to be updated
modified = true;
// use the new license
- result.setLicense(newHeader.getLicense());
+ result.setLicense( newHeader.getLicense() );
}
-
- if (!modified) {
+ if ( !modified )
+ {
+
// nothing has to be updated, so return a {@code null} result
result = null;
}
@@ -139,28 +151,32 @@
@Override
@Deprecated
- protected String treateHeader(String ch) {
+ protected String treateHeader( String ch )
+ {
- if (getLog().isDebugEnabled()) {
- getLog().debug("header\n" + ch);
+ if ( getLog().isDebugEnabled() )
+ {
+ getLog().debug( "header\n" + ch );
}
FileHeaderTransformer transformer = getTransformer();
// unbox comment
- String unbox = transformer.unboxComent(ch);
+ String unbox = transformer.unboxComent( ch );
- if (getLog().isDebugEnabled()) {
- getLog().info("unboxed comment header\n" + unbox);
+ if ( getLog().isDebugEnabled() )
+ {
+ getLog().info( "unboxed comment header\n" + unbox );
}
// obtain current license of file
- FileHeader fileHeader = transformer.toFileHeader(unbox);
+ FileHeader fileHeader = transformer.toFileHeader( unbox );
// updates license
- fileHeader.setLicense(getFileHeader().getLicense());
+ fileHeader.setLicense( getFileHeader().getLicense() );
- if (isUpdateCopyright()) {
+ if ( isUpdateCopyright() )
+ {
// 1) obtain the svn last comit on this file
// 2) compute the last year of copyright
@@ -169,51 +185,57 @@
//fileHeader.setCopyrightLastYear(lastYear);
}
// build new brut header (with no boxing)
- String newHeader = transformer.toString(fileHeader);
+ String newHeader = transformer.toString( fileHeader );
// box with process tag
- newHeader = transformer.boxProcessTag(newHeader);
+ newHeader = transformer.boxProcessTag( newHeader );
// box header with comment prefix
- newHeader = transformer.boxComment(newHeader, false);
+ 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 index = newHeader.indexOf( transformer.getProcessStartTag() );
int lastIndex =
- newHeader.lastIndexOf(transformer.getProcessEndTag()) +
- transformer.getProcessEndTag().length();
+ newHeader.lastIndexOf( transformer.getProcessEndTag() ) + transformer.getProcessEndTag().length();
- String result = newHeader.substring(index, lastIndex);
+ String result = newHeader.substring( index, lastIndex );
- if (getLog().isDebugEnabled()) {
- getLog().debug("updated Header =\n" + result);
+ if ( getLog().isDebugEnabled() )
+ {
+ getLog().debug( "updated Header =\n" + result );
}
return result;
}
- public boolean isUpdateCopyright() {
+ public boolean isUpdateCopyright()
+ {
return updateCopyright;
}
- public void setUpdateCopyright(boolean updateCopyright) {
+ public void setUpdateCopyright( boolean updateCopyright )
+ {
this.updateCopyright = updateCopyright;
}
- public boolean isUpdateDescription() {
+ public boolean isUpdateDescription()
+ {
return updateDescription;
}
- public void setUpdateDescription(boolean updateDescription) {
+ public void setUpdateDescription( boolean updateDescription )
+ {
this.updateDescription = updateDescription;
}
- public boolean isUpdateLicense() {
+ public boolean isUpdateLicense()
+ {
return updateLicense;
}
- public void setUpdateLicense(boolean updateLicense) {
+ public void setUpdateLicense( boolean updateLicense )
+ {
this.updateLicense = updateLicense;
}
}
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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformer.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -38,7 +38,9 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public abstract class AbstractFileHeaderTransformer implements FileHeaderTransformer {
+public abstract class AbstractFileHeaderTransformer
+ implements FileHeaderTransformer
+{
/**
* pattern of the copyright string representation :
@@ -51,54 +53,66 @@
* </ul>
*/
protected static final Pattern COPYRIGHT_PATTERN =
- Pattern.compile(
- "(.[^\\d]+)?\\s(\\d{4})?(\\s+-\\s+(\\d{4})?){0,1}\\s+(.+)?"
- );
+ Pattern.compile( "(.[^\\d]+)?\\s(\\d{4})?(\\s+-\\s+(\\d{4})?){0,1}\\s+(.+)?" );
- /** name of transformer */
+ /**
+ * name of transformer
+ */
protected String name;
- /** description of transfomer */
+ /**
+ * description of transfomer
+ */
protected String description;
- /** section delimiter */
+ /**
+ * section delimiter
+ */
protected String sectionDelimiter = DEFAULT_SECTION_DELIMITER;
- /** start process tag */
+ /**
+ * start process tag
+ */
protected String processStartTag = DEFAULT_PROCESS_START_TAG;
- /** end process tag */
+ /**
+ * end process tag
+ */
protected String processEndTag = DEFAULT_PROCESS_END_TAG;
- /** comment start tag */
+ /**
+ * comment start tag
+ */
protected String commentStartTag;
- /** comment end tag */
+ /**
+ * comment end tag
+ */
protected String commentEndTag;
- /** comment line prefix (to add for header content) */
+ /**
+ * comment line prefix (to add for header content)
+ */
protected String commentLinePrefix;
- protected AbstractFileHeaderTransformer(String name,
- String description,
- String commentStartTag,
- String commentEndTag,
- String commentLinePrefix) {
+ protected AbstractFileHeaderTransformer( String name, String description, String commentStartTag,
+ String commentEndTag, String commentLinePrefix )
+ {
this.name = name;
this.description = description;
// checks comment start tag is different from comment prefix
- if (commentStartTag.equals(commentLinePrefix)) {
+ if ( commentStartTag.equals( commentLinePrefix ) )
+ {
throw new IllegalStateException(
- "commentStartTag can not be equals to commentPrefixLine, " +
- "but was [" + commentStartTag + "]");
+ "commentStartTag can not be equals to commentPrefixLine, " + "but was [" + commentStartTag + "]" );
}
// checks comment end tag is different from comment prefix
- if (commentEndTag.equals(commentLinePrefix)) {
+ if ( commentEndTag.equals( commentLinePrefix ) )
+ {
throw new IllegalStateException(
- "commentEndTag can not be equals to commentPrefixLine, " +
- "but was [" + commentEndTag + "]");
+ "commentEndTag can not be equals to commentPrefixLine, " + "but was [" + commentEndTag + "]" );
}
this.commentStartTag = commentStartTag;
@@ -107,275 +121,317 @@
}
@Override
- public String getName() {
+ public String getName()
+ {
return name;
}
@Override
- public void setName(String name) {
+ public void setName( String name )
+ {
this.name = name;
}
@Override
- public String getDescription() {
+ public String getDescription()
+ {
return description;
}
@Override
- public void setDescription(String description) {
+ public void setDescription( String description )
+ {
this.description = description;
}
@Override
- public String getSectionDelimiter() {
+ public String getSectionDelimiter()
+ {
return sectionDelimiter;
}
@Override
- public void setSectionDelimiter(String sectionDelimiter) {
+ public void setSectionDelimiter( String sectionDelimiter )
+ {
this.sectionDelimiter = sectionDelimiter;
}
@Override
- public String getProcessStartTag() {
+ public String getProcessStartTag()
+ {
return processStartTag;
}
@Override
- public void setProcessStartTag(String processStartTag) {
+ public void setProcessStartTag( String processStartTag )
+ {
this.processStartTag = processStartTag;
}
@Override
- public String getProcessEndTag() {
+ public String getProcessEndTag()
+ {
return processEndTag;
}
@Override
- public void setProcessEndTag(String processEndTag) {
+ public void setProcessEndTag( String processEndTag )
+ {
this.processEndTag = processEndTag;
}
@Override
- public String getCommentStartTag() {
+ public String getCommentStartTag()
+ {
return commentStartTag;
}
@Override
- public void setCommentStartTag(String commentStartTag) {
+ public void setCommentStartTag( String commentStartTag )
+ {
this.commentStartTag = commentStartTag;
}
@Override
- public String getCommentEndTag() {
+ public String getCommentEndTag()
+ {
return commentEndTag;
}
@Override
- public void setCommentEndTag(String commentEndTag) {
+ public void setCommentEndTag( String commentEndTag )
+ {
this.commentEndTag = commentEndTag;
}
@Override
- public String getCommentLinePrefix() {
+ public String getCommentLinePrefix()
+ {
return commentLinePrefix;
}
@Override
- public String addHeader(String header, String content) {
+ public String addHeader( String header, String content )
+ {
return header + content;
}
@Override
- public void setCommentLinePrefix(String commentLinePrefix) {
+ public void setCommentLinePrefix( String commentLinePrefix )
+ {
this.commentLinePrefix = commentLinePrefix;
}
@Override
- public FileHeader toFileHeader(String header) {
+ public FileHeader toFileHeader( String header )
+ {
FileHeader model = new FileHeader();
- String[] sections = header.split(getSectionDelimiter());
- if (sections.length != 3) {
- throw new IllegalStateException(
- "could not find 3 sections in\n" + header);
+ String[] sections = header.split( getSectionDelimiter() );
+ if ( sections.length != 3 )
+ {
+ throw new IllegalStateException( "could not find 3 sections in\n" + header );
}
// first section is the description
String description = sections[0].trim();
- model.setDescription(description);
+ model.setDescription( description );
// second section is the copyright
String copyright = sections[1].trim();
- Matcher matcher = COPYRIGHT_PATTERN.matcher(copyright);
- if (!matcher.matches()) {
- throw new IllegalStateException(
- "copyright [" + copyright + "] is not valid");
+ Matcher matcher = COPYRIGHT_PATTERN.matcher( copyright );
+ if ( !matcher.matches() )
+ {
+ throw new IllegalStateException( "copyright [" + copyright + "] is not valid" );
}
- String firstYear = matcher.group(2);
- String lastYear = matcher.group(4);
- String holder = matcher.group(5);
- model.setCopyrightFirstYear(Integer.valueOf(firstYear.trim()));
- if (lastYear != null) {
- model.setCopyrightLastYear(Integer.valueOf(lastYear.trim()));
+ String firstYear = matcher.group( 2 );
+ String lastYear = matcher.group( 4 );
+ String holder = matcher.group( 5 );
+ model.setCopyrightFirstYear( Integer.valueOf( firstYear.trim() ) );
+ if ( lastYear != null )
+ {
+ model.setCopyrightLastYear( Integer.valueOf( lastYear.trim() ) );
}
- model.setCopyrightHolder(holder.trim());
+ model.setCopyrightHolder( holder.trim() );
// third section is the license
String license = sections[2].trim();
- model.setLicense(license);
+ model.setLicense( license );
return model;
}
@Override
- public String toString(FileHeader model) throws NullPointerException {
- if (model == null) {
- throw new NullPointerException("model can not be null!");
+ 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() +
- LINE_SEPARATOR;
+ String sectionDelimiter = LINE_SEPARATOR + getSectionDelimiter() + LINE_SEPARATOR;
// add description section
- buffer.append(model.getDescription().trim());
- buffer.append(sectionDelimiter);
+ buffer.append( model.getDescription().trim() );
+ buffer.append( sectionDelimiter );
// add copyright section
- buffer.append(model.getCopyright().trim());
- buffer.append(sectionDelimiter);
+ buffer.append( model.getCopyright().trim() );
+ buffer.append( sectionDelimiter );
// add license section
- buffer.append(model.getLicense().trim()).append(LINE_SEPARATOR);
+ buffer.append( model.getLicense().trim() ).append( LINE_SEPARATOR );
return buffer.toString();
}
@Override
- public String toHeaderContent(FileHeader model) throws NullPointerException {
+ public String toHeaderContent( FileHeader model )
+ throws NullPointerException
+ {
String result;
// model to text
- result = toString(model);
+ result = toString( model );
// box with process tag
- result = boxProcessTag(result);
+ result = boxProcessTag( result );
// box header with comment prefix
- result = boxComment(result, false);
+ result = boxComment( result, false );
// remove all before process start tag
// remove all after process end tag
// this is a requirement for processor to respect involution.
- int index = result.indexOf(getProcessStartTag());
- int lastIndex =
- result.lastIndexOf(getProcessEndTag()) +
- getProcessEndTag().length();
+ int index = result.indexOf( getProcessStartTag() );
+ int lastIndex = result.lastIndexOf( getProcessEndTag() ) + getProcessEndTag().length();
- result = result.substring(index, lastIndex);
+ result = result.substring( index, lastIndex );
return result;
}
@Override
- public String boxComment(String header, boolean withTags) {
+ public String boxComment( String header, boolean withTags )
+ {
StringBuilder buffer = new StringBuilder();
- if (withTags) {
- buffer.append(getCommentStartTag()).append(LINE_SEPARATOR);
+ if ( withTags )
+ {
+ buffer.append( getCommentStartTag() ).append( LINE_SEPARATOR );
}
- for (String line : header.split(LINE_SEPARATOR + "")) {
- buffer.append(getCommentLinePrefix());
- buffer.append(line);
- buffer.append(LINE_SEPARATOR);
+ for ( String line : header.split( LINE_SEPARATOR + "" ) )
+ {
+ buffer.append( getCommentLinePrefix() );
+ buffer.append( line );
+ buffer.append( LINE_SEPARATOR );
}
- if (withTags) {
- buffer.append(getCommentEndTag()).append(LINE_SEPARATOR);
+ if ( withTags )
+ {
+ buffer.append( getCommentEndTag() ).append( LINE_SEPARATOR );
}
return buffer.toString();
}
@Override
- public String unboxComent(String header) {
+ public String unboxComent( String header )
+ {
StringBuilder buffer = new StringBuilder();
int prefixLength = getCommentLinePrefix().length();
- for (String line : header.split(LINE_SEPARATOR + "")) {
- if (line.isEmpty() ||
- line.contains(getCommentStartTag()) ||
- line.contains(getCommentEndTag())) {
+ for ( String line : header.split( LINE_SEPARATOR + "" ) )
+ {
+ if ( line.isEmpty() || line.contains( getCommentStartTag() ) || line.contains( getCommentEndTag() ) )
+ {
// not be unboxed, but just skipped
continue;
}
- int index = line.indexOf(getCommentLinePrefix());
- if (index > -1) {
+ int index = line.indexOf( getCommentLinePrefix() );
+ if ( index > -1 )
+ {
// remove comment prefix
- line = line.substring(index + prefixLength);
- } else {
+ line = line.substring( index + prefixLength );
+ }
+ else
+ {
String s = getCommentLinePrefix().trim();
- if (line.startsWith(s)) {
- if (line.length() <= s.length()) {
+ if ( line.startsWith( s ) )
+ {
+ if ( line.length() <= s.length() )
+ {
line = "";
}
- } else {
- line = line.substring(s.length());
}
+ else
+ {
+ line = line.substring( s.length() );
+ }
}
- buffer.append(line).append(LINE_SEPARATOR);
+ buffer.append( line ).append( LINE_SEPARATOR );
}
return buffer.toString();
}
@Override
- public String boxProcessTag(String header) {
+ public String boxProcessTag( String header )
+ {
StringBuilder buffer = new StringBuilder();
- buffer.append(getProcessStartTag()).append(LINE_SEPARATOR);
- buffer.append(header.trim()).append(LINE_SEPARATOR);
- buffer.append(getProcessEndTag()).append(LINE_SEPARATOR);
+ buffer.append( getProcessStartTag() ).append( LINE_SEPARATOR );
+ buffer.append( header.trim() ).append( LINE_SEPARATOR );
+ buffer.append( getProcessEndTag() ).append( LINE_SEPARATOR );
return buffer.toString();
}
@Override
- public String unboxProcessTag(String boxedHeader) {
+ public String unboxProcessTag( String boxedHeader )
+ {
StringBuilder buffer = new StringBuilder();
- for (String line : boxedHeader.split(LINE_SEPARATOR + "")) {
- if (line.isEmpty() ||
- line.contains(getProcessStartTag()) ||
- line.contains(getProcessEndTag())) {
+ for ( String line : boxedHeader.split( LINE_SEPARATOR + "" ) )
+ {
+ if ( line.isEmpty() || line.contains( getProcessStartTag() ) || line.contains( getProcessEndTag() ) )
+ {
// not be unboxed, but just skipped
continue;
}
- buffer.append(line).append(LINE_SEPARATOR);
+ buffer.append( line ).append( LINE_SEPARATOR );
}
return buffer.toString();
}
@Override
- public boolean isDescriptionEquals(FileHeader header1, FileHeader header2) {
- return header1.getDescription().equals(header2.getDescription());
+ public boolean isDescriptionEquals( FileHeader header1, FileHeader header2 )
+ {
+ return header1.getDescription().equals( header2.getDescription() );
}
@Override
- public boolean isCopyrightEquals(FileHeader header1, FileHeader header2) {
- return header1.getCopyright().equals(header2.getCopyright());
+ public boolean isCopyrightEquals( FileHeader header1, FileHeader header2 )
+ {
+ return header1.getCopyright().equals( header2.getCopyright() );
}
@Override
- public boolean isLicenseEquals(FileHeader header1, FileHeader header2) {
- String license1 = removeSpaces(header1.getLicense());
- String license2 = removeSpaces(header2.getLicense());
- boolean result = license1.equals(license2);
+ public boolean isLicenseEquals( FileHeader header1, FileHeader header2 )
+ {
+ String license1 = removeSpaces( header1.getLicense() );
+ String license2 = removeSpaces( header2.getLicense() );
+ boolean result = license1.equals( license2 );
return result;
}
- protected static final Pattern REMOVE_SPACE_PATTERN = Pattern.compile("(\\s+)");
+ protected static final Pattern REMOVE_SPACE_PATTERN = Pattern.compile( "(\\s+)" );
- protected String removeSpaces(String str) {
- Matcher matcher = REMOVE_SPACE_PATTERN.matcher(str);
+ protected String removeSpaces( String str )
+ {
+ Matcher matcher = REMOVE_SPACE_PATTERN.matcher( str );
String result;
- if (matcher.find()) {
- result = matcher.replaceAll("");
- } else {
+ if ( matcher.find() )
+ {
+ result = matcher.replaceAll( "" );
+ }
+ else
+ {
result = str;
}
return result;
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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/AptFileHeaderTransformer.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -32,7 +32,9 @@
* @plexus.component role-hint="apt"
* @since 2.1
*/
-public class AptFileHeaderTransformer extends AbstractFileHeaderTransformer {
+public class AptFileHeaderTransformer
+ extends AbstractFileHeaderTransformer
+{
public static final String NAME = "apt";
@@ -44,17 +46,14 @@
public static final String COMMENT_END_TAG = "~~~";
- public AptFileHeaderTransformer() {
- super(NAME,
- DESCRIPTION,
- COMMENT_START_TAG,
- COMMENT_END_TAG,
- COMMENT_LINE_PREFIX
- );
+ public AptFileHeaderTransformer()
+ {
+ super( NAME, DESCRIPTION, COMMENT_START_TAG, COMMENT_END_TAG, COMMENT_LINE_PREFIX );
}
@Override
- public String[] getDefaultAcceptedExtensions() {
- return new String[]{"apt"};
+ public String[] getDefaultAcceptedExtensions()
+ {
+ return new String[]{ "apt" };
}
}
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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/FileHeaderTransformer.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -47,26 +47,39 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public interface FileHeaderTransformer {
+public interface FileHeaderTransformer
+{
- /** Plexus component role */
+ /**
+ * Plexus component role
+ */
String ROLE_NAME = FileHeaderTransformer.class.getName();
- /** default section delimiter */
+ /**
+ * default section delimiter
+ */
String DEFAULT_SECTION_DELIMITER = "%" + "%";
- /** default process start tag */
+ /**
+ * default process start tag
+ */
String DEFAULT_PROCESS_START_TAG = "#" + "%" + "L";
- /** default process end tag */
+ /**
+ * default process end tag
+ */
String DEFAULT_PROCESS_END_TAG = "#" + "L" + "%";
char LINE_SEPARATOR = '\n';
- /** @return the name of the transformer */
+ /**
+ * @return the name of the transformer
+ */
String getName();
- /** @return the description of the transformer */
+ /**
+ * @return the description of the transformer
+ */
String getDescription();
/**
@@ -110,13 +123,19 @@
*/
String getSectionDelimiter();
- /** @return the start tag of a comment */
+ /**
+ * @return the start tag of a comment
+ */
String getCommentStartTag();
- /** @return the end tag of a comment */
+ /**
+ * @return the end tag of a comment
+ */
String getCommentEndTag();
- /** @return the line prefix of every line insed the comment */
+ /**
+ * @return the line prefix of every line insed the comment
+ */
String getCommentLinePrefix();
/**
@@ -126,7 +145,7 @@
* @param content content of original file
* @return the new full file content beginning with header
*/
- String addHeader(String header, String content);
+ String addHeader( String header, String content );
/**
* Box the given {@code header} in a comment.
@@ -135,7 +154,7 @@
* @param withTags flag to add start and end comment tags.
* @return the header content WITH comment boxing
*/
- String boxComment(String header, boolean withTags);
+ String boxComment( String header, boolean withTags );
/**
* Unbox the given boxed {@code boxedHeader} to obtain the header content.
@@ -143,7 +162,7 @@
* @param boxedHeader the boxed header
* @return the unboxed header.
*/
- String unboxComent(String boxedHeader);
+ String unboxComent( String boxedHeader );
/**
* Box the given {@code header} between process tags.
@@ -153,7 +172,7 @@
* @see #getProcessStartTag()
* @see #getProcessEndTag()
*/
- String boxProcessTag(String header);
+ String boxProcessTag( String header );
/**
* Unbox the process tag on the given boxed {@code boxedHeader} to obtain
@@ -164,7 +183,7 @@
* @see #getProcessStartTag()
* @see #getProcessEndTag()
*/
- String unboxProcessTag(String boxedHeader);
+ String unboxProcessTag( String boxedHeader );
/**
* Build a {@link FileHeader} from an UNBOXED header content.
@@ -172,7 +191,7 @@
* @param header unboxed header content
* @return The model of the header content
*/
- FileHeader toFileHeader(String header);
+ FileHeader toFileHeader( String header );
/**
* Build a UNBOXED header content from the given {@code model}.
@@ -181,7 +200,8 @@
* @return the UNBOXED header content
* @throws NullPointerException if model is null
*/
- String toString(FileHeader model) throws NullPointerException;
+ String toString( FileHeader model )
+ throws NullPointerException;
/**
* Build a fully boxed header content from the given {@code model}.
@@ -190,7 +210,8 @@
* @return the fully boxed header content
* @throws NullPointerException if model is null
*/
- String toHeaderContent(FileHeader model) throws NullPointerException;
+ String toHeaderContent( FileHeader model )
+ throws NullPointerException;
/**
* Tests if the description of the two models are equals.
@@ -200,7 +221,7 @@
* @return {@code true} if headers description are stricly the same
* @since 2.3.2
*/
- boolean isDescriptionEquals(FileHeader header1, FileHeader header2);
+ boolean isDescriptionEquals( FileHeader header1, FileHeader header2 );
/**
* Tests if the copyright of the two models are equals.
@@ -210,7 +231,7 @@
* @return {@code true} if headers copyright are stricly the same
* @since 2.3.2
*/
- boolean isCopyrightEquals(FileHeader header1, FileHeader header2);
+ boolean isCopyrightEquals( FileHeader header1, FileHeader header2 );
/**
* Tests if the license of the two models are equals.
@@ -220,21 +241,21 @@
* @return {@code true} if headers license are stricly the same (WITHOUT ANY space)
* @since 2.3.2
*/
- boolean isLicenseEquals(FileHeader header1, FileHeader header2);
+ boolean isLicenseEquals( FileHeader header1, FileHeader header2 );
/**
* Changes the name of the transformer.
*
* @param name the new name of the transformer
*/
- void setName(String name);
+ void setName( String name );
/**
* Chages the description of the transformer.
*
* @param description the new description of the transformer
*/
- void setDescription(String description);
+ void setDescription( String description );
/**
* Sets the header section delimiter.
@@ -243,40 +264,40 @@
*
* @param headerSectionDelimiter the new delimiter
*/
- void setSectionDelimiter(String headerSectionDelimiter);
+ void setSectionDelimiter( String headerSectionDelimiter );
/**
* Changes the process start tag.
*
* @param tag the new start tag
*/
- void setProcessStartTag(String tag);
+ void setProcessStartTag( String tag );
/**
* Changes the process end tag.
*
* @param tag the new endtag
*/
- void setProcessEndTag(String tag);
+ void setProcessEndTag( String tag );
/**
* Changes the comment start tag.
*
* @param commentStartTag the new comment start tag
*/
- void setCommentStartTag(String commentStartTag);
+ void setCommentStartTag( String commentStartTag );
/**
* Changes the comment end tag.
*
* @param commentEndTag the new comment end tag
*/
- void setCommentEndTag(String commentEndTag);
+ void setCommentEndTag( String commentEndTag );
/**
* Changes the comment prefix line.
*
* @param commentLinePrefix the new comment prefix line
*/
- void setCommentLinePrefix(String commentLinePrefix);
+ 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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/JavaFileHeaderTransformer.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -32,7 +32,9 @@
* @plexus.component role-hint="java"
* @since 2.1
*/
-public class JavaFileHeaderTransformer extends AbstractFileHeaderTransformer {
+public class JavaFileHeaderTransformer
+ extends AbstractFileHeaderTransformer
+{
public static final String NAME = "java";
@@ -44,27 +46,15 @@
public static final String COMMENT_END_TAG = " */";
- public JavaFileHeaderTransformer() {
- super(NAME,
- DESCRIPTION,
- COMMENT_START_TAG,
- COMMENT_END_TAG,
- COMMENT_LINE_PREFIX
- );
+ public JavaFileHeaderTransformer()
+ {
+ super( NAME, DESCRIPTION, COMMENT_START_TAG, COMMENT_END_TAG, COMMENT_LINE_PREFIX );
}
@Override
- public String[] getDefaultAcceptedExtensions() {
- return new String[]{
- "java",
- "groovy",
- "css",
- "cs",
- "as",
- "aj",
- "c",
- "h",
- "cpp"
+ public String[] getDefaultAcceptedExtensions()
+ {
+ return new String[]{ "java", "groovy", "css", "cs", "as", "aj", "c", "h", "cpp"
};
}
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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/PropertiesFileHeaderTransformer.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -32,7 +32,9 @@
* @plexus.component role-hint="properties"
* @since 2.1
*/
-public class PropertiesFileHeaderTransformer extends AbstractFileHeaderTransformer {
+public class PropertiesFileHeaderTransformer
+ extends AbstractFileHeaderTransformer
+{
public static final String NAME = "properties";
@@ -44,24 +46,14 @@
public static final String COMMENT_END_TAG = "###";
- public PropertiesFileHeaderTransformer() {
- super(NAME,
- DESCRIPTION,
- COMMENT_START_TAG,
- COMMENT_END_TAG,
- COMMENT_LINE_PREFIX
- );
+ public PropertiesFileHeaderTransformer()
+ {
+ super( NAME, DESCRIPTION, COMMENT_START_TAG, COMMENT_END_TAG, COMMENT_LINE_PREFIX );
}
@Override
- public String[] getDefaultAcceptedExtensions() {
- return new String[]{
- "properties",
- "sh",
- "py",
- "rb",
- "pl",
- "pm"
- };
+ public String[] getDefaultAcceptedExtensions()
+ {
+ return new String[]{ "properties", "sh", "py", "rb", "pl", "pm" };
}
}
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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/RstFileHeaderTransformer.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -32,7 +32,9 @@
* @plexus.component role-hint="rst"
* @since 2.1
*/
-public class RstFileHeaderTransformer extends AbstractFileHeaderTransformer {
+public class RstFileHeaderTransformer
+ extends AbstractFileHeaderTransformer
+{
public static final String NAME = "rst";
@@ -44,17 +46,14 @@
public static final String COMMENT_END_TAG = ".. -";
- public RstFileHeaderTransformer() {
- super(NAME,
- DESCRIPTION,
- COMMENT_START_TAG,
- COMMENT_END_TAG,
- COMMENT_LINE_PREFIX
- );
+ public RstFileHeaderTransformer()
+ {
+ super( NAME, DESCRIPTION, COMMENT_START_TAG, COMMENT_END_TAG, COMMENT_LINE_PREFIX );
}
@Override
- public String[] getDefaultAcceptedExtensions() {
- return new String[]{"rst"};
+ public String[] getDefaultAcceptedExtensions()
+ {
+ return new String[]{ "rst" };
}
}
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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformer.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -32,12 +32,13 @@
* @plexus.component role-hint="xml"
* @since 2.1
*/
-public class XmlFileHeaderTransformer extends AbstractFileHeaderTransformer {
+public class XmlFileHeaderTransformer
+ extends AbstractFileHeaderTransformer
+{
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 = " ";
@@ -45,64 +46,52 @@
public static final String COMMENT_END_TAG = " -->";
- public XmlFileHeaderTransformer() {
- super(NAME,
- DESCRIPTION,
- COMMENT_START_TAG,
- COMMENT_END_TAG,
- COMMENT_LINE_PREFIX
- );
+ public XmlFileHeaderTransformer()
+ {
+ super( NAME, DESCRIPTION, COMMENT_START_TAG, COMMENT_END_TAG, COMMENT_LINE_PREFIX );
}
@Override
- public String[] getDefaultAcceptedExtensions() {
- return new String[]{
- "pom",
- "xml",
- "xhtml",
- "mxlm",
- "dtd",
- "jsp",
- "jspx",
- "fml",
- "xsl",
- "html",
- "htm",
- "jaxx",
- "kml",
- "gsp",
- "tml"
- };
+ public String[] getDefaultAcceptedExtensions()
+ {
+ return new String[]{ "pom", "xml", "xhtml", "mxlm", "dtd", "jsp", "jspx", "fml", "xsl", "html", "htm", "jaxx",
+ "kml", "gsp", "tml" };
}
@Override
- public String addHeader(String header, String content) {
+ public String addHeader( String header, String content )
+ {
String result;
String prolog = null;
- int startProlog = content.indexOf("<?xml");
- if (startProlog > -1) {
+ int startProlog = content.indexOf( "<?xml" );
+ if ( startProlog > -1 )
+ {
// prolog start was detected
- int endProlog = content.indexOf("?>", startProlog);
+ int endProlog = content.indexOf( "?>", startProlog );
- if (endProlog > -1) {
+ if ( endProlog > -1 )
+ {
// prolog end was detected
- prolog = content.substring(0, endProlog + 2);
+ prolog = content.substring( 0, endProlog + 2 );
}
}
- if (prolog == null) {
+ if ( prolog == null )
+ {
// no prolog detected
- result = super.addHeader(header, content);
- } else {
+ result = super.addHeader( header, content );
+ }
+ else
+ {
// prolog detected
- content = content.substring(prolog.length());
- result = super.addHeader(prolog + '\n' + header, content);
+ content = content.substring( prolog.length() );
+ result = super.addHeader( prolog + '\n' + header, content );
}
return result;
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/model/License.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/License.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/License.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -41,88 +41,114 @@
*
* @author tchemit <chemit(a)codelutin.com>
*/
-public class License {
+public class License
+{
public static final String LICENSE_HEADER_FILE = "header.txt";
public static final String LICENSE_CONTENT_FILE = "license.txt";
- /** base url of license (directory where to find license files) */
+ /**
+ * base url of license (directory where to find license files)
+ */
protected URL baseURL;
- /** the name of the licenses (ex lgpl-3.0) */
+ /**
+ * the name of the licenses (ex lgpl-3.0)
+ */
protected String name;
- /** the description of the license */
+ /**
+ * the description of the license
+ */
protected String description;
- /** url of the license's content */
+ /**
+ * url of the license's content
+ */
protected URL licenseURL;
- /** url of the license header's content */
+ /**
+ * url of the license header's content
+ */
protected URL headerURL;
- public License() {
+ public License()
+ {
}
- public String getName() {
+ public String getName()
+ {
return name;
}
- public URL getLicenseURL() {
- if (licenseURL == null) {
- licenseURL = PluginHelper.getUrl(getBaseURL(), LICENSE_CONTENT_FILE);
+ public URL getLicenseURL()
+ {
+ if ( licenseURL == null )
+ {
+ licenseURL = PluginHelper.getUrl( getBaseURL(), LICENSE_CONTENT_FILE );
}
return licenseURL;
}
- public URL getHeaderURL() {
- if (headerURL == null) {
- headerURL = PluginHelper.getUrl(getBaseURL(), LICENSE_HEADER_FILE);
+ public URL getHeaderURL()
+ {
+ if ( headerURL == null )
+ {
+ headerURL = PluginHelper.getUrl( getBaseURL(), LICENSE_HEADER_FILE );
}
return headerURL;
}
- public String getDescription() {
+ public String getDescription()
+ {
return description;
}
- public URL getBaseURL() {
+ public URL getBaseURL()
+ {
return baseURL;
}
- public String getLicenseContent(String encoding) throws IOException {
- if (baseURL == null) {
- throw new IllegalStateException(
- "no baseURL defined, can not obtain license content in " +
- this);
+ public String getLicenseContent( String encoding )
+ throws IOException
+ {
+ if ( baseURL == null )
+ {
+ throw new IllegalStateException( "no baseURL defined, can not obtain license content in " + this );
}
- Reader r = new BufferedReader(
- new InputStreamReader(getLicenseURL().openStream(), encoding));
- try {
- return IOUtil.toString(r);
- } finally {
+ Reader r = new BufferedReader( new InputStreamReader( getLicenseURL().openStream(), encoding ) );
+ try
+ {
+ return IOUtil.toString( r );
+ }
+ finally
+ {
r.close();
}
}
- public String getHeaderContent(String encoding) throws IOException {
- if (baseURL == null) {
- throw new IllegalStateException(
- "no baseURL defined, can not obtain header content in " +
- this);
+ public String getHeaderContent( String encoding )
+ throws IOException
+ {
+ if ( baseURL == null )
+ {
+ throw new IllegalStateException( "no baseURL defined, can not obtain header content in " + this );
}
- Reader r = new BufferedReader(
- new InputStreamReader(getHeaderURL().openStream(), encoding));
- try {
- return IOUtil.toString(r);
- } finally {
+ Reader r = new BufferedReader( new InputStreamReader( getHeaderURL().openStream(), encoding ) );
+ try
+ {
+ return IOUtil.toString( r );
+ }
+ finally
+ {
r.close();
}
}
- public void setName(String name) {
+ public void setName( String name )
+ {
this.name = name;
}
@@ -136,24 +162,24 @@
// this.headerURL = headerURL;
// }
- public void setDescription(String description) {
+ public void setDescription( String description )
+ {
this.description = description;
}
- public void setBaseURL(URL baseURL) {
+ public void setBaseURL( URL baseURL )
+ {
this.baseURL = baseURL;
}
@Override
- public String toString() {
- ToStringBuilder builder = new ToStringBuilder(
- this,
- ToStringStyle.MULTI_LINE_STYLE
- );
- builder.append("name", name);
- builder.append("description", description);
- builder.append("licenseURL", getLicenseURL());
- builder.append("headerURL", getHeaderURL());
+ public String toString()
+ {
+ ToStringBuilder builder = new ToStringBuilder( this, ToStringStyle.MULTI_LINE_STYLE );
+ builder.append( "name", name );
+ builder.append( "description", description );
+ builder.append( "licenseURL", getLicenseURL() );
+ builder.append( "headerURL", getHeaderURL() );
return builder.toString();
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/LicenseRepository.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -32,24 +32,36 @@
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map.Entry;
+import java.util.Properties;
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0.3
*/
-public class LicenseRepository implements Iterable<License> {
+public class LicenseRepository
+ implements Iterable<License>
+{
- /** Logger */
- private static final Log log = LogFactory.getLog(LicenseRepository.class);
+ /**
+ * Logger
+ */
+ private static final Log log = LogFactory.getLog( LicenseRepository.class );
public static final String REPOSITORY_DEFINITION_FILE = "licenses.properties";
- /** the base url of the licenses repository */
+ /**
+ * the base url of the licenses repository
+ */
protected URL baseURL;
- /** licenses of this repository */
+ /**
+ * licenses of this repository
+ */
protected List<License> licenses;
/**
@@ -58,93 +70,110 @@
*/
protected boolean init;
- public LicenseRepository() {
+ public LicenseRepository()
+ {
}
- public URL getBaseURL() {
+ public URL getBaseURL()
+ {
return baseURL;
}
- public void setBaseURL(URL baseURL) {
- checkNotInit("setBaseURL");
+ public void setBaseURL( URL baseURL )
+ {
+ checkNotInit( "setBaseURL" );
this.baseURL = baseURL;
}
- public void load() throws IOException {
- checkNotInit("load");
- try {
- if (baseURL == null || baseURL.toString().trim().isEmpty()) {
- throw new IllegalStateException(
- "no baseURL defined in " + this);
+ public void load()
+ throws IOException
+ {
+ checkNotInit( "load" );
+ try
+ {
+ if ( baseURL == null || baseURL.toString().trim().isEmpty() )
+ {
+ throw new IllegalStateException( "no baseURL defined in " + this );
}
- URL definitionURL = PluginHelper.getUrl(
- getBaseURL(),
- REPOSITORY_DEFINITION_FILE
- );
- if (licenses != null) {
+ URL definitionURL = PluginHelper.getUrl( getBaseURL(), REPOSITORY_DEFINITION_FILE );
+ if ( licenses != null )
+ {
licenses.clear();
- } else {
+ }
+ else
+ {
licenses = new ArrayList<License>();
}
- if (!checkExists(definitionURL)) {
+ if ( !checkExists( definitionURL ) )
+ {
throw new IllegalArgumentException(
- "no licenses.properties found with url [" +
- definitionURL + "] for resolver " + this);
+ "no licenses.properties found with url [" + definitionURL + "] for resolver " + this );
}
Properties p = new Properties();
- p.load(definitionURL.openStream());
+ p.load( definitionURL.openStream() );
- for (Entry<Object, Object> entry : p.entrySet()) {
+ for ( Entry<Object, Object> entry : p.entrySet() )
+ {
String licenseName = (String) entry.getKey();
licenseName = licenseName.trim().toLowerCase();
String licenseDescription = (String) entry.getValue();
- URL licenseURL = PluginHelper.getUrl(baseURL, licenseName);
+ URL licenseURL = PluginHelper.getUrl( baseURL, licenseName );
License license = new License();
- license.setName(licenseName);
- license.setDescription(licenseDescription);
- license.setBaseURL(licenseURL);
- if (log.isInfoEnabled()) {
- log.info("register " + license.getDescription());
+ license.setName( licenseName );
+ license.setDescription( licenseDescription );
+ license.setBaseURL( licenseURL );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "register " + license.getDescription() );
}
- if (log.isDebugEnabled()) {
- log.debug(license);
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( license );
}
- licenses.add(license);
+ licenses.add( license );
}
- licenses = Collections.unmodifiableList(licenses);
- } finally {
+ licenses = Collections.unmodifiableList( licenses );
+ }
+ finally
+ {
// mark repository as available
init = true;
}
}
- public String[] getLicenseNames() {
- checkInit("getLicenseNames");
- List<String> result = new ArrayList<String>(licenses.size());
- for (License license : this) {
- result.add(license.getName());
+ public String[] getLicenseNames()
+ {
+ checkInit( "getLicenseNames" );
+ List<String> result = new ArrayList<String>( licenses.size() );
+ for ( License license : this )
+ {
+ result.add( license.getName() );
}
- return result.toArray(new String[result.size()]);
+ return result.toArray( new String[result.size()] );
}
- public License[] getLicenses() {
- checkInit("getLicenses");
- return licenses.toArray(new License[licenses.size()]);
+ public License[] getLicenses()
+ {
+ checkInit( "getLicenses" );
+ return licenses.toArray( new License[licenses.size()] );
}
- public License getLicense(String licenseName) {
- checkInit("getLicense");
- if (licenseName == null || licenseName.trim().isEmpty()) {
- throw new IllegalArgumentException(
- "licenceName can not be null, nor empty");
+ public License getLicense( String licenseName )
+ {
+ checkInit( "getLicense" );
+ if ( licenseName == null || licenseName.trim().isEmpty() )
+ {
+ throw new IllegalArgumentException( "licenceName can not be null, nor empty" );
}
License license = null;
- for (License l : this) {
- if (licenseName.equals(l.getName())) {
+ for ( License l : this )
+ {
+ if ( licenseName.equals( l.getName() ) )
+ {
// got it
license = l;
break;
@@ -154,29 +183,36 @@
}
@Override
- public Iterator<License> iterator() {
- checkInit("iterator");
+ public Iterator<License> iterator()
+ {
+ checkInit( "iterator" );
return licenses.iterator();
}
- protected boolean checkExists(URL url) throws IOException {
+ protected boolean checkExists( URL url )
+ throws IOException
+ {
URLConnection openConnection = url.openConnection();
return openConnection.getContentLength() > 0;
}
- protected void checkInit(String operation) throws IllegalStateException {
- if (!init) {
+ protected void checkInit( String operation )
+ throws IllegalStateException
+ {
+ if ( !init )
+ {
throw new IllegalStateException(
- "repository " + this + " was not init, operation [" +
- operation + "] not possible.");
+ "repository " + this + " was not init, operation [" + operation + "] not possible." );
}
}
- protected void checkNotInit(String operation) throws IllegalStateException {
- if (init) {
+ protected void checkNotInit( String operation )
+ throws IllegalStateException
+ {
+ if ( init )
+ {
throw new IllegalStateException(
- "repository " + this + "was init, operation [" +
- operation + "+] not possible.");
+ "repository " + this + "was init, operation [" + operation + "+] not possible." );
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/LicenseStore.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -41,132 +41,179 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class LicenseStore implements Iterable<LicenseRepository> {
+public class LicenseStore
+ implements Iterable<LicenseRepository>
+{
- /** Logger */
- private static final Log log = LogFactory.getLog(LicenseStore.class);
+ /**
+ * Logger
+ */
+ private static final Log log = LogFactory.getLog( LicenseStore.class );
- /** class-path directory where is the licenses repository */
+ /**
+ * class-path directory where is the licenses repository
+ */
public static final String JAR_LICENSE_REPOSITORY = "/META-INF/licenses";
- /** list of available license repositories */
+ /**
+ * list of available license repositories
+ */
protected List<LicenseRepository> repositories;
- /** flag to know if store was init */
+ /**
+ * flag to know if store was init
+ */
protected boolean init;
- public void init() throws IOException {
- checkNotInit("init");
- try {
- if (repositories == null) {
+ public void init()
+ throws IOException
+ {
+ checkNotInit( "init" );
+ try
+ {
+ if ( repositories == null )
+ {
// adding the default class-path repository
addJarRepository();
}
- for (LicenseRepository r : this) {
+ for ( LicenseRepository r : this )
+ {
r.load();
}
- } finally {
+ }
+ finally
+ {
init = true;
}
}
- public List<LicenseRepository> getRepositories() {
+ public List<LicenseRepository> getRepositories()
+ {
return repositories;
}
- public String[] getLicenseNames() {
- checkInit("getLicenseNames");
+ public String[] getLicenseNames()
+ {
+ checkInit( "getLicenseNames" );
List<String> result = new ArrayList<String>();
- for (LicenseRepository repository : this) {
- for (License license : repository) {
- result.add(license.getName());
+ for ( LicenseRepository repository : this )
+ {
+ for ( License license : repository )
+ {
+ result.add( license.getName() );
}
}
- return result.toArray(new String[result.size()]);
+ return result.toArray( new String[result.size()] );
}
- public License[] getLicenses() {
- checkInit("getLicenses");
+ public License[] getLicenses()
+ {
+ checkInit( "getLicenses" );
List<License> result = new ArrayList<License>();
- if (repositories != null) {
- for (LicenseRepository repository : this) {
- for (License license : repository) {
- result.add(license);
+ if ( repositories != null )
+ {
+ for ( LicenseRepository repository : this )
+ {
+ for ( License license : repository )
+ {
+ result.add( license );
}
}
}
- return result.toArray(new License[result.size()]);
+ return result.toArray( new License[result.size()] );
}
- public License getLicense(String licenseName) {
- checkInit("getLicense");
+ public License getLicense( String licenseName )
+ {
+ checkInit( "getLicense" );
Iterator<LicenseRepository> itr = iterator();
License result = null;
- while (itr.hasNext()) {
+ while ( itr.hasNext() )
+ {
LicenseRepository licenseRepository = itr.next();
- License license = licenseRepository.getLicense(licenseName);
- if (license != null) {
+ License license = licenseRepository.getLicense( licenseName );
+ if ( license != null )
+ {
result = license;
break;
}
}
- if (result == null && log.isDebugEnabled()) {
- log.debug("could not find license named '" + licenseName + "'");
+ if ( result == null && log.isDebugEnabled() )
+ {
+ log.debug( "could not find license named '" + licenseName + "'" );
}
return result;
}
- public void addRepository(String extraResolver) throws IOException {
- addRepository(new URL(extraResolver));
+ public void addRepository( String extraResolver )
+ throws IOException
+ {
+ addRepository( new URL( extraResolver ) );
}
- public void addRepository(URL baseURL) throws IOException {
- checkNotInit("addRepository");
+ public void addRepository( URL baseURL )
+ throws IOException
+ {
+ checkNotInit( "addRepository" );
LicenseRepository repository = new LicenseRepository();
- repository.setBaseURL(baseURL);
- if (log.isDebugEnabled()) {
- log.debug("Adding a license repository " + repository);
+ repository.setBaseURL( baseURL );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Adding a license repository " + repository );
}
- addRepository(repository);
+ addRepository( repository );
}
- public void addJarRepository() throws IOException {
- checkNotInit("addJarRepository");
- URL baseURL = getClass().getResource(JAR_LICENSE_REPOSITORY);
+ public void addJarRepository()
+ throws IOException
+ {
+ checkNotInit( "addJarRepository" );
+ URL baseURL = getClass().getResource( JAR_LICENSE_REPOSITORY );
LicenseRepository repository = new LicenseRepository();
- repository.setBaseURL(baseURL);
- if (log.isDebugEnabled()) {
- log.debug("Adding a jar license repository " + repository);
+ repository.setBaseURL( baseURL );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Adding a jar license repository " + repository );
}
- addRepository(repository);
+ addRepository( repository );
}
@Override
- public Iterator<LicenseRepository> iterator() {
+ public Iterator<LicenseRepository> iterator()
+ {
return getRepositories().iterator();
}
- protected void addRepository(LicenseRepository repository) {
- checkNotInit("addRepository");
- if (repositories == null) {
+ protected void addRepository( LicenseRepository repository )
+ {
+ checkNotInit( "addRepository" );
+ if ( repositories == null )
+ {
repositories = new ArrayList<LicenseRepository>();
}
- if (log.isInfoEnabled()) {
- log.info("Adding a license repository " + repository.getBaseURL());
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Adding a license repository " + repository.getBaseURL() );
}
- repositories.add(repository);
+ repositories.add( repository );
}
- protected void checkInit(String operation) throws IllegalStateException {
- if (!init) {
- throw new IllegalStateException("store was not init, operation [" + operation + "] not possible.");
+ protected void checkInit( String operation )
+ throws IllegalStateException
+ {
+ if ( !init )
+ {
+ throw new IllegalStateException( "store was not init, operation [" + operation + "] not possible." );
}
}
- protected void checkNotInit(String operation) throws IllegalStateException {
- if (init) {
- throw new IllegalStateException("store was init, operation [" + operation + "+] not possible.");
+ protected void checkNotInit( String operation )
+ throws IllegalStateException
+ {
+ if ( init )
+ {
+ throw new IllegalStateException( "store was init, operation [" + operation + "+] not possible." );
}
}
}
Modified: trunk/src/main/java/org/nuiton/license/plugin/model/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/model/package.html 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/main/java/org/nuiton/license/plugin/model/package.html 2010-11-21 13:28:04 UTC (rev 1890)
@@ -28,7 +28,7 @@
This package contains all models of the project.
<ul>
<li>LicenceProjectDescriptor api (generated by modello)</li>
- <li>License api </li>
+ <li>License api</li>
</ul>
</body>
</html>
Modified: trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd
===================================================================
--- trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/site/resources/licenseProjectDescriptor-1.0.0.xsd 2010-11-21 13:28:04 UTC (rev 1890)
@@ -1,17 +1,19 @@
<?xml version="1.0"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" targetNamespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+ xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
+ targetNamespace="http://maven-site.nuiton.org/maven-license-plugin/1.0.0">
<xs:element name="project" type="LicenseProjectDescriptor">
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
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>
+ <li>mainLicense of the project</li>
+ <li>headers to update (or add) on sources of the project</li>
</ul>
-
+
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -19,14 +21,14 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
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>
+ <li>mainLicense of the project</li>
+ <li>headers to update (or add) on sources of the project</li>
</ul>
-
+
</xs:documentation>
</xs:annotation>
<xs:all>
@@ -34,10 +36,10 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
- The main license of the project (or module). The LICENSE.txt will
- contains the content of this license.
-
+
+ The main license of the project (or module). The LICENSE.txt will
+ contains the content of this license.
+
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -45,11 +47,11 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
Collection of header.
-
+
{@link Header}
-
+
</xs:documentation>
</xs:annotation>
<xs:complexType>
@@ -62,11 +64,11 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
To add a single header.
{@link Header}
-
+
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -76,11 +78,11 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
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.
-
+
</xs:documentation>
</xs:annotation>
<xs:all>
@@ -88,10 +90,10 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
- The license to apply in this set. If not fill, will use
- the main license.
-
+
+ The license to apply in this set. If not fill, will use
+ the main license.
+
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -99,9 +101,9 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
The style of the comment which box the header to generate (or updates).
-
+
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -109,10 +111,10 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
Specifies file sets to include in the license set. A fileSet is
specified by providing one or more of &lt;licenseSet&gt; subelements.
-
+
</xs:documentation>
</xs:annotation>
<xs:complexType>
@@ -125,10 +127,10 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
Specifies a single file sets to include in the license set. A fileSet is
specified by providing one or more of &lt;licenseSet&gt; subelements.
-
+
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -138,10 +140,10 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
- A fileSet allows the inclusion of groups of files into the license set
- and defines also the type of header to generate.
-
+
+ A fileSet allows the inclusion of groups of files into the license set
+ and defines also the type of header to generate.
+
</xs:documentation>
</xs:annotation>
<xs:all>
@@ -171,11 +173,11 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
When &lt;include&gt; subelements are present, they define a set of
files and directory to include. If none is present, then
&lt;includes&gt; represents all valid values.
-
+
</xs:documentation>
</xs:annotation>
<xs:complexType>
@@ -188,14 +190,14 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
<p>
To add a single include.
</p>
When &lt;include&gt; subelements are present, they define a set of
files and directory to include. If none is present, then
&lt;includes&gt; represents all valid values.
-
+
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -203,11 +205,11 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
When &lt;exclude&gt; subelements are present, they define a set of
files and directory to exclude. If none is present, then
&lt;excludes&gt; represents no exclusions.
-
+
</xs:documentation>
</xs:annotation>
<xs:complexType>
@@ -220,14 +222,14 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
<p>
To add a single exclude.
</p>
When &lt;exclude&gt; subelements are present, they define a set of
files and directory to exclude. If none is present, then
&lt;excludes&gt; represents no exclusions.
-
+
</xs:documentation>
</xs:annotation>
</xs:element>
@@ -235,17 +237,17 @@
<xs:annotation>
<xs:documentation source="version">1.0.0+</xs:documentation>
<xs:documentation source="description">
-
+
Sets the line-endings of the files in this fileSet.
Valid values:
<ul>
- <li><b>"keep"</b> - Preserve all line endings</li>
- <li><b>"unix"</b> - Use Unix-style line endings</li>
- <li><b>"lf"</b> - Use a single line-feed line endings</li>
- <li><b>"dos"</b> - Use DOS-style line endings</li>
- <li><b>"crlf"</b> - Use Carraige-return, line-feed line endings</li>
+ <li><b>"keep"</b> - Preserve all line endings</li>
+ <li><b>"unix"</b> - Use Unix-style line endings</li>
+ <li><b>"lf"</b> - Use a single line-feed line endings</li>
+ <li><b>"dos"</b> - Use DOS-style line endings</li>
+ <li><b>"crlf"</b> - Use Carraige-return, line-feed line endings</li>
</ul>
-
+
</xs:documentation>
</xs:annotation>
</xs:element>
Modified: trunk/src/site/site_en.xml
===================================================================
--- trunk/src/site/site_en.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/site/site_en.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -50,8 +50,8 @@
<links>
<item name="Libre-Entreprise" href="http://www.libre-entreprise.org/"/>
- <item name="[fr" href="./fr/index.html" />
- <item name="en]" href="index.html" />
+ <item name="[fr" href="./fr/index.html"/>
+ <item name="en]" href="index.html"/>
</links>
<menu name="User">
@@ -78,14 +78,14 @@
<menu name="Downloads">
<item
- href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}.jar"
- name="Library (jar)"/>
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}.jar"
+ name="Library (jar)"/>
<item
- href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar"
- name="Javadoc (jar)"/>
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar"
+ name="Javadoc (jar)"/>
<item
- href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar"
- name="Sources (jar)"/>
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar"
+ name="Sources (jar)"/>
</menu>
<menu ref="reports"/>
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/site/site_fr.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -49,8 +49,8 @@
<links>
<item name="Libre-Entreprise" href="http://www.libre-entreprise.org/"/>
- <item name="[fr" href="index.html" />
- <item name="en]" href="../index.html" />
+ <item name="[fr" href="index.html"/>
+ <item name="en]" href="../index.html"/>
</links>
<menu name="Utilisateur">
@@ -77,14 +77,14 @@
<menu name="Téléchargements">
<item
- href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}.jar"
- name="Librairie (jar)"/>
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}.jar"
+ name="Librairie (jar)"/>
<item
- href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar"
- name="Javadoc (jar)"/>
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar"
+ name="Javadoc (jar)"/>
<item
- href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar"
- name="Sources (jar)"/>
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar"
+ name="Sources (jar)"/>
</menu>
<menu ref="reports"/>
Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/java/org/nuiton/license/plugin/UpdateFileHeaderMojoTest.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -26,7 +26,6 @@
package org.nuiton.license.plugin;
import org.junit.Assert;
-import org.junit.Ignore;
import org.junit.Test;
import org.nuiton.plugin.AbstractMojoTest;
import org.nuiton.plugin.PluginHelper;
@@ -42,7 +41,9 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class UpdateFileHeaderMojoTest extends AbstractMojoTest<UpdateFileHeaderMojo> {
+public class UpdateFileHeaderMojoTest
+ extends AbstractMojoTest<UpdateFileHeaderMojo>
+{
private Set<File> uptodates;
@@ -58,25 +59,31 @@
private Set<File> process;
@Override
- protected String getGoalName(String methodName) {
+ protected String getGoalName( String methodName )
+ {
return "update-file-header";
}
@Override
- protected void clearMojo(UpdateFileHeaderMojo mojo) {
+ protected void clearMojo( UpdateFileHeaderMojo mojo )
+ {
mojo.clear();
}
@Override
- protected void setUpMojo(UpdateFileHeaderMojo mojo, File pomFile) throws Exception {
- super.setUpMojo(mojo, pomFile);
- mojo.getProject().setBasedir(new File(mojo.getProject().getBasedir(),getMethodName()));
+ protected void setUpMojo( UpdateFileHeaderMojo mojo, File pomFile )
+ throws Exception
+ {
+ super.setUpMojo( mojo, pomFile );
+ mojo.getProject().setBasedir( new File( mojo.getProject().getBasedir(), getMethodName() ) );
}
@Test
- public void addLicense() throws Exception {
+ public void addLicense()
+ throws Exception
+ {
- File f = getMyBeanFile(getMethodName());
+ File f = getMyBeanFile( getMethodName() );
UpdateFileHeaderMojo mojo = getMojo();
String content;
@@ -88,249 +95,261 @@
// checkPattern(f, content, "Project name : maven-license-plugin-java", false);
// checkPattern(f, content, "Organization is CodeLutin", false);
- execute(true, mojo);
- Assert.assertEquals(1, process.size());
+ execute( true, mojo );
+ Assert.assertEquals( 1, process.size() );
- if (uptodates == null) {
- Assert.assertEquals(1, adds.size());
- } else {
- Assert.assertEquals(1, uptodates.size());
- Assert.assertNull(adds);
+ if ( uptodates == null )
+ {
+ Assert.assertEquals( 1, adds.size() );
}
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ else
+ {
+ Assert.assertEquals( 1, uptodates.size() );
+ Assert.assertNull( adds );
+ }
+ 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);
+ checkPattern( f, content, "Copyright (C) 2010", true );
+ checkPattern( f, content, "Project name : maven-license-plugin-java", true );
+ checkPattern( f, content, "Organization is CodeLutin", true );
// re execute mojo to make sure we are in uptodate
- execute(false, mojo);
+ execute( false, mojo );
- Assert.assertEquals(1, process.size());
- Assert.assertEquals(1, uptodates.size());
+ Assert.assertEquals( 1, process.size() );
+ Assert.assertEquals( 1, uptodates.size() );
int oldLength = content.length();
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ content = PluginHelper.readAsString( f, mojo.getEncoding() );
int newLength = content.length();
- Assert.assertEquals(oldLength, newLength);
+ Assert.assertEquals( oldLength, newLength );
}
@Test
- public void all() throws Exception {
+ public void all()
+ throws Exception
+ {
UpdateFileHeaderMojo mojo = getMojo();
- mojo.setClearAfterOperation(false);
- execute(true, mojo);
- Assert.assertEquals(4, process.size());
+ mojo.setClearAfterOperation( false );
+ execute( true, mojo );
+ Assert.assertEquals( 4, process.size() );
- if (uptodates == null) {
+ if ( uptodates == null )
+ {
// first invocation
- Assert.assertEquals(1, updates.size());
- Assert.assertEquals(1, adds.size());
- Assert.assertNull(uptodates);
- } else {
- Assert.assertNotNull(uptodates);
- Assert.assertEquals(2, uptodates.size());
- Assert.assertNull(adds);
- Assert.assertNull(updates);
+ Assert.assertEquals( 1, updates.size() );
+ Assert.assertEquals( 1, adds.size() );
+ Assert.assertNull( uptodates );
}
- Assert.assertEquals(1, fails.size());
- Assert.assertEquals(1, ignores.size());
+ else
+ {
+ Assert.assertNotNull( uptodates );
+ Assert.assertEquals( 2, uptodates.size() );
+ Assert.assertNull( adds );
+ Assert.assertNull( updates );
+ }
+ Assert.assertEquals( 1, fails.size() );
+ Assert.assertEquals( 1, ignores.size() );
- execute(false, mojo);
+ execute( false, mojo );
- Assert.assertEquals(4, process.size());
- Assert.assertNotNull(uptodates);
- Assert.assertNull(updates);
+ Assert.assertEquals( 4, process.size() );
+ Assert.assertNotNull( uptodates );
+ Assert.assertNull( updates );
// Assert.assertEquals(2, uptodates.size());
- Assert.assertEquals(2, uptodates.size());
- Assert.assertNull(adds);
- Assert.assertNull(updates);
- Assert.assertEquals(1, fails.size());
- Assert.assertEquals(1, ignores.size());
+ Assert.assertEquals( 2, uptodates.size() );
+ Assert.assertNull( adds );
+ Assert.assertNull( updates );
+ Assert.assertEquals( 1, fails.size() );
+ Assert.assertEquals( 1, ignores.size() );
- mojo.setClearAfterOperation(true);
+ mojo.setClearAfterOperation( true );
mojo.execute();
- Assert.assertEquals(0, process.size());
- for (FileState state : FileState.values()) {
+ Assert.assertEquals( 0, process.size() );
+ for ( FileState state : FileState.values() )
+ {
- Assert.assertNull(mojo.getFiles(state));
+ Assert.assertNull( mojo.getFiles( state ) );
}
}
@Test
- public void updateLicense() throws Exception {
+ public void updateLicense()
+ throws Exception
+ {
- File f = getMyBeanFile(getMethodName());
+ File f = getMyBeanFile( getMethodName() );
UpdateFileHeaderMojo mojo = getMojo();
String content;
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ 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, "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);
- execute(true, mojo);
+ execute( true, mojo );
- Assert.assertEquals(1, process.size());
- if (uptodates != null) {
+ 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());
+ Assert.assertEquals( 1, uptodates.size() );
+ Assert.assertNull( updates );
}
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ else
+ {
+ Assert.assertNull( uptodates );
+ Assert.assertEquals( 1, updates.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);
+ 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);
+ checkPattern( f, content, "Fake to be removed!", false );
- execute(false, mojo);
+ execute( false, mojo );
- Assert.assertEquals(1, process.size());
- Assert.assertNotNull(uptodates);
- Assert.assertEquals(1, uptodates.size());
- Assert.assertNull(updates);
+ Assert.assertEquals( 1, process.size() );
+ Assert.assertNotNull( uptodates );
+ Assert.assertEquals( 1, uptodates.size() );
+ Assert.assertNull( updates );
// Assert.assertEquals(1, uptodates.size());
// Assert.assertNull(updates);
int oldLength = content.length();
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ content = PluginHelper.readAsString( f, mojo.getEncoding() );
int newLength = content.length();
- Assert.assertEquals(oldLength, newLength);
+ Assert.assertEquals( oldLength, newLength );
}
@Test
- public void failLicense() throws Exception {
+ public void failLicense()
+ throws Exception
+ {
- File f = getMyBeanFile(getMethodName());
+ File f = getMyBeanFile( getMethodName() );
UpdateFileHeaderMojo mojo = getMojo();
String content;
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ 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, "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);
- execute(true, mojo);
- Assert.assertEquals(1, process.size());
- Assert.assertEquals(1, fails.size());
+ execute( true, mojo );
+ Assert.assertEquals( 1, process.size() );
+ Assert.assertEquals( 1, fails.size() );
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ 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);
+ 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 );
- execute(false, mojo);
- Assert.assertEquals(1, process.size());
- Assert.assertEquals(1, fails.size());
+ execute( false, mojo );
+ Assert.assertEquals( 1, process.size() );
+ Assert.assertEquals( 1, fails.size() );
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ 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);
+ 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 {
+ public void ignoreLicense()
+ throws Exception
+ {
- File f = getMyBeanFile(getMethodName());
+ File f = getMyBeanFile( getMethodName() );
UpdateFileHeaderMojo mojo = getMojo();
String content;
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ 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);
+ 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 );
- execute(true, mojo);
+ execute( true, mojo );
- Assert.assertEquals(1, process.size());
- Assert.assertEquals(1, ignores.size());
+ Assert.assertEquals( 1, process.size() );
+ Assert.assertEquals( 1, ignores.size() );
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ 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);
+ 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 );
- execute(false, mojo);
+ execute( false, mojo );
- Assert.assertEquals(1, process.size());
- Assert.assertEquals(1, ignores.size());
+ Assert.assertEquals( 1, process.size() );
+ Assert.assertEquals( 1, ignores.size() );
- content = PluginHelper.readAsString(f, mojo.getEncoding());
+ 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);
+ 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 {
+ public void skip()
+ throws Exception
+ {
UpdateFileHeaderMojo mojo = getMojo();
mojo.execute();
- Assert.assertTrue(mojo.isSkip());
+ Assert.assertTrue( mojo.isSkip() );
}
- protected void execute(boolean verbose,
- UpdateFileHeaderMojo mojo) throws Exception {
- mojo.setVerbose(verbose);
+ 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);
+ 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",
- "test-classes",
- "org",
- "nuiton",
- "license",
- "plugin",
- "updateFileHeaderMojoTest",
- testName,
- "src",
- "MyBean.java"
- );
+ protected File getMyBeanFile( String testName )
+ {
+ File f = PluginHelper.getFile( getBasedir(), "target", "test-classes", "org", "nuiton", "license", "plugin",
+ "updateFileHeaderMojoTest", 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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/java/org/nuiton/license/plugin/UpdateProjectLicenseMojoTest.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -36,44 +36,47 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-public class UpdateProjectLicenseMojoTest extends AbstractMojoTest<UpdateProjectLicenseMojo> {
+public class UpdateProjectLicenseMojoTest
+ extends AbstractMojoTest<UpdateProjectLicenseMojo>
+{
@Override
- protected String getGoalName(String methodName) {
+ 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()) {
+ 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.setOutputDirectory( outputDirectory );
// mojo.setDescriptor(new File(outputDirectory, mojo.getDescriptor().getName()));
- if (!outputDirectory.exists()) {
- if (!outputDirectory.mkdirs()) {
- throw new IOException(
- "could not create directory : " + outputDirectory);
+ if ( !outputDirectory.exists() )
+ {
+ if ( !outputDirectory.mkdirs() )
+ {
+ throw new IOException( "could not create directory : " + outputDirectory );
}
}
- mojo.setLicenseFile(new File(pomFile.getParentFile(),
- mojo.getLicenseFile().toString())
- );
+ 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()));
+ 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 {
+ public void testOne()
+ throws Exception
+ {
UpdateProjectLicenseMojo mojo = getMojo();
@@ -82,27 +85,29 @@
// always assume pom is older than any file
// since we can not ensure order of copy test resources
- PluginHelper.setLastModified(mojo.getProject().getFile(), 0);
+ PluginHelper.setLastModified( mojo.getProject().getFile(), 0 );
- mojo.setVerbose(true);
+ mojo.setVerbose( true );
// then executing the mojo, will do NOT change the licence file
mojo.execute();
long t1 = licenseFile.lastModified();
- assertEquals(t0, t1);
+ assertEquals( t0, t1 );
// force to override the license file
- mojo.setForce(true);
- mojo.setVerbose(false);
+ mojo.setForce( true );
+ mojo.setVerbose( false );
mojo.execute();
t1 = licenseFile.lastModified();
- assertTrue(t1 > t0);
+ assertTrue( t1 > t0 );
}
@Test
- public void testTwo() throws Exception {
+ public void testTwo()
+ throws Exception
+ {
UpdateProjectLicenseMojo mojo = getMojo();
@@ -111,34 +116,36 @@
// always assume pom is older than any file
// since we can not ensure order of copy test resources
- PluginHelper.setLastModified(mojo.getProject().getFile(), 0);
+ PluginHelper.setLastModified( mojo.getProject().getFile(), 0 );
- mojo.setVerbose(true);
+ mojo.setVerbose( true );
// then executing the mojo, will do NOT change the licence file
mojo.execute();
long t1 = licenseFile.lastModified();
- assertEquals(t0, t1);
+ assertEquals( t0, t1 );
// force to override the license file
- mojo.setForce(true);
- mojo.setVerbose(false);
+ mojo.setForce( true );
+ mojo.setVerbose( false );
mojo.execute();
t1 = licenseFile.lastModified();
- assertTrue(t1 > t0);
+ assertTrue( t1 > t0 );
}
@Test
- public void skip() throws Exception {
+ public void skip()
+ throws Exception
+ {
UpdateProjectLicenseMojo mojo = getMojo();
mojo.execute();
- Assert.assertTrue(mojo.isSkip());
+ Assert.assertTrue( mojo.isSkip() );
}
}
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-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -38,9 +38,7 @@
import static org.nuiton.license.plugin.header.transformer.FileHeaderTransformer.DEFAULT_PROCESS_START_TAG;
import static org.nuiton.license.plugin.header.transformer.FileHeaderTransformer.DEFAULT_SECTION_DELIMITER;
import static org.nuiton.license.plugin.header.transformer.FileHeaderTransformer.LINE_SEPARATOR;
-import static org.nuiton.license.plugin.header.transformer.JavaFileHeaderTransformer.COMMENT_END_TAG;
-import static org.nuiton.license.plugin.header.transformer.JavaFileHeaderTransformer.COMMENT_LINE_PREFIX;
-import static org.nuiton.license.plugin.header.transformer.JavaFileHeaderTransformer.COMMENT_START_TAG;
+import static org.nuiton.license.plugin.header.transformer.JavaFileHeaderTransformer.*;
/**
* Tests the {@link AbstractFileHeaderTransformer}.
@@ -48,65 +46,80 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class AbstractFileHeaderTransformerTest {
+public class AbstractFileHeaderTransformerTest
+{
FileHeaderTransformer transformer;
FileHeader model1, model2;
@Before
- public void setUp() throws Exception {
+ public void setUp()
+ throws Exception
+ {
transformer = new JavaFileHeaderTransformer();
model1 = new FileHeader();
- model1.setDescription("Description");
- model1.setCopyrightFirstYear(2010);
- model1.setCopyrightLastYear(null);
- model1.setCopyrightHolder("Tony");
- model1.setLicense("License");
+ model1.setDescription( "Description" );
+ model1.setCopyrightFirstYear( 2010 );
+ model1.setCopyrightLastYear( null );
+ model1.setCopyrightHolder( "Tony" );
+ model1.setLicense( "License" );
model2 = new FileHeader();
- model2.setDescription("Description2");
- model2.setCopyrightFirstYear(2010);
- model2.setCopyrightLastYear(2012);
- model2.setCopyrightHolder("Tony2");
- model2.setLicense("License2");
+ model2.setDescription( "Description2" );
+ model2.setCopyrightFirstYear( 2010 );
+ model2.setCopyrightLastYear( 2012 );
+ model2.setCopyrightHolder( "Tony2" );
+ model2.setLicense( "License2" );
}
@After
- public void tearDown() throws Exception {
+ public void tearDown()
+ throws Exception
+ {
transformer = null;
model1 = null;
model2 = null;
}
- @Test(expected = IllegalStateException.class)
- public void testIllegalTransformer() throws Exception {
+ @Test( expected = IllegalStateException.class )
+ public void testIllegalTransformer()
+ throws Exception
+ {
- new AbstractFileHeaderTransformer("name", "description", "commentPrefix", "commentEndtag", "commentPrefix") {
+ new AbstractFileHeaderTransformer( "name", "description", "commentPrefix", "commentEndtag", "commentPrefix" )
+ {
@Override
- public String[] getDefaultAcceptedExtensions() {
- return new String[]{getName()};
+ public String[] getDefaultAcceptedExtensions()
+ {
+ return new String[]{ getName() };
}
};
}
- @Test(expected = IllegalStateException.class)
- public void testIllegalTransformer2() throws Exception {
+ @Test( expected = IllegalStateException.class )
+ public void testIllegalTransformer2()
+ throws Exception
+ {
- new AbstractFileHeaderTransformer("name", "description", "commentstartTag", "commentPrefix", "commentPrefix") {
+ new AbstractFileHeaderTransformer( "name", "description", "commentstartTag", "commentPrefix", "commentPrefix" )
+ {
@Override
- public String[] getDefaultAcceptedExtensions() {
- return new String[]{getName()};
+ public String[] getDefaultAcceptedExtensions()
+ {
+ return new String[]{ getName() };
}
};
}
@Test
- public void testCopyrightPattern() throws Exception {
+ public void testCopyrightPattern()
+ throws Exception
+ {
String actual;
Matcher matcher;
String prefix;
@@ -115,211 +128,184 @@
String holder;
actual = "Copyright (C) 2010 Tony";
- matcher = COPYRIGHT_PATTERN.matcher(actual);
- Assert.assertTrue(matcher.matches());
- Assert.assertEquals(5, matcher.groupCount());
- prefix = matcher.group(1);
- Assert.assertEquals("Copyright (C)", prefix);
- firstYear = matcher.group(2);
- Assert.assertEquals("2010", firstYear);
- lastYear = matcher.group(4);
- Assert.assertEquals(null, lastYear);
- holder = matcher.group(5);
- Assert.assertEquals("Tony", holder);
+ matcher = COPYRIGHT_PATTERN.matcher( actual );
+ Assert.assertTrue( matcher.matches() );
+ Assert.assertEquals( 5, matcher.groupCount() );
+ prefix = matcher.group( 1 );
+ Assert.assertEquals( "Copyright (C)", prefix );
+ firstYear = matcher.group( 2 );
+ Assert.assertEquals( "2010", firstYear );
+ lastYear = matcher.group( 4 );
+ Assert.assertEquals( null, lastYear );
+ holder = matcher.group( 5 );
+ Assert.assertEquals( "Tony", holder );
actual = "Copyright (C) 2010 - 2012 Tony";
- matcher = COPYRIGHT_PATTERN.matcher(actual);
- Assert.assertTrue(matcher.matches());
- Assert.assertEquals(5, matcher.groupCount());
- prefix = matcher.group(1);
- Assert.assertEquals("Copyright (C)", prefix);
- firstYear = matcher.group(2);
- Assert.assertEquals("2010", firstYear);
- lastYear = matcher.group(4);
- Assert.assertEquals("2012", lastYear);
- holder = matcher.group(5);
- Assert.assertEquals("Tony", holder);
+ matcher = COPYRIGHT_PATTERN.matcher( actual );
+ Assert.assertTrue( matcher.matches() );
+ Assert.assertEquals( 5, matcher.groupCount() );
+ prefix = matcher.group( 1 );
+ Assert.assertEquals( "Copyright (C)", prefix );
+ firstYear = matcher.group( 2 );
+ Assert.assertEquals( "2010", firstYear );
+ lastYear = matcher.group( 4 );
+ Assert.assertEquals( "2012", lastYear );
+ holder = matcher.group( 5 );
+ Assert.assertEquals( "Tony", holder );
}
@Test
- public void testToFileHeader() throws Exception {
+ public void testToFileHeader()
+ throws Exception
+ {
String header;
FileHeader model;
- header = "Description" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "Copyright (C) 2010 Tony" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "License";
- model = transformer.toFileHeader(header);
- Assert.assertNotNull(model);
- assertEquals(model1, model);
+ header =
+ "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "Copyright (C) 2010 Tony" +
+ LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "License";
+ model = transformer.toFileHeader( header );
+ Assert.assertNotNull( model );
+ assertEquals( model1, model );
- header = "Description2" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "License2";
- model = transformer.toFileHeader(header);
- Assert.assertNotNull(model);
- assertEquals(model2, model);
+ header = "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
+ "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
+ "License2";
+ model = transformer.toFileHeader( header );
+ Assert.assertNotNull( model );
+ assertEquals( model2, model );
}
@Test
- public void testToString() throws Exception {
+ public void testToString()
+ throws Exception
+ {
String header;
- header = transformer.toString(model1);
- Assert.assertEquals("Description" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "Copyright (C) 2010 Tony" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "License" + LINE_SEPARATOR,
- header
- );
+ header = transformer.toString( model1 );
+ Assert.assertEquals(
+ "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "Copyright (C) 2010 Tony" +
+ LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + "License" + LINE_SEPARATOR, header );
- header = transformer.toString(model2);
- Assert.assertEquals("Description2" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "License2" + LINE_SEPARATOR,
- header
- );
+ header = transformer.toString( model2 );
+ Assert.assertEquals( "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
+ "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
+ "License2" + LINE_SEPARATOR, header );
}
@Test
- public void testBoxProcessTag() throws Exception {
+ public void testBoxProcessTag()
+ throws Exception
+ {
String header;
String boxedHeader;
- header = transformer.toString(model1);
- boxedHeader = transformer.boxProcessTag(header);
- Assert.assertEquals(DEFAULT_PROCESS_START_TAG + LINE_SEPARATOR +
- "Description" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "Copyright (C) 2010 Tony" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "License" + LINE_SEPARATOR +
- DEFAULT_PROCESS_END_TAG + LINE_SEPARATOR,
- boxedHeader
- );
+ header = transformer.toString( model1 );
+ boxedHeader = transformer.boxProcessTag( header );
+ Assert.assertEquals(
+ DEFAULT_PROCESS_START_TAG + LINE_SEPARATOR + "Description" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER +
+ LINE_SEPARATOR + "Copyright (C) 2010 Tony" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER +
+ LINE_SEPARATOR + "License" + LINE_SEPARATOR + DEFAULT_PROCESS_END_TAG + LINE_SEPARATOR, boxedHeader );
- header = transformer.toString(model2);
- boxedHeader = transformer.boxProcessTag(header);
- Assert.assertEquals(DEFAULT_PROCESS_START_TAG + LINE_SEPARATOR +
- "Description2" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR +
- DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- "License2" + LINE_SEPARATOR +
- DEFAULT_PROCESS_END_TAG + LINE_SEPARATOR,
- boxedHeader
- );
+ header = transformer.toString( model2 );
+ boxedHeader = transformer.boxProcessTag( header );
+ Assert.assertEquals(
+ DEFAULT_PROCESS_START_TAG + LINE_SEPARATOR + "Description2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER +
+ LINE_SEPARATOR + "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + DEFAULT_SECTION_DELIMITER +
+ LINE_SEPARATOR + "License2" + LINE_SEPARATOR + DEFAULT_PROCESS_END_TAG + LINE_SEPARATOR, boxedHeader );
}
@Test
- public void testUnboxProcessTag() throws Exception {
+ public void testUnboxProcessTag()
+ throws Exception
+ {
String header;
String boxedHeader;
String unboxedHeader;
- header = transformer.toString(model1);
- boxedHeader = transformer.boxProcessTag(header);
- unboxedHeader = transformer.unboxProcessTag(boxedHeader);
+ header = transformer.toString( model1 );
+ boxedHeader = transformer.boxProcessTag( header );
+ unboxedHeader = transformer.unboxProcessTag( boxedHeader );
- Assert.assertEquals(header, unboxedHeader);
+ Assert.assertEquals( header, unboxedHeader );
- header = transformer.toString(model2);
- boxedHeader = transformer.boxProcessTag(header);
- unboxedHeader = transformer.unboxProcessTag(boxedHeader);
+ header = transformer.toString( model2 );
+ boxedHeader = transformer.boxProcessTag( header );
+ unboxedHeader = transformer.unboxProcessTag( boxedHeader );
- Assert.assertEquals(header, unboxedHeader);
+ Assert.assertEquals( header, unboxedHeader );
}
@Test
- public void testBoxComment() throws Exception {
+ public void testBoxComment()
+ throws Exception
+ {
String header;
String boxedHeader;
- header = transformer.toString(model1);
- boxedHeader = transformer.boxComment(header, true);
+ header = transformer.toString( model1 );
+ boxedHeader = transformer.boxComment( header, true );
- Assert.assertEquals(
- COMMENT_START_TAG + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "Description" + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "Copyright (C) 2010 Tony" + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "License" + LINE_SEPARATOR +
- COMMENT_END_TAG + LINE_SEPARATOR,
- boxedHeader
- );
+ Assert.assertEquals( COMMENT_START_TAG + LINE_SEPARATOR + COMMENT_LINE_PREFIX + "Description" + LINE_SEPARATOR +
+ COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + COMMENT_LINE_PREFIX +
+ "Copyright (C) 2010 Tony" + LINE_SEPARATOR + COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER +
+ LINE_SEPARATOR + COMMENT_LINE_PREFIX + "License" + LINE_SEPARATOR + COMMENT_END_TAG + LINE_SEPARATOR,
+ boxedHeader );
- boxedHeader = transformer.boxComment(header, false);
+ boxedHeader = transformer.boxComment( header, false );
Assert.assertEquals(
- COMMENT_LINE_PREFIX + "Description" + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "Copyright (C) 2010 Tony" + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "License" + LINE_SEPARATOR,
- boxedHeader
- );
+ COMMENT_LINE_PREFIX + "Description" + LINE_SEPARATOR + COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER +
+ LINE_SEPARATOR + COMMENT_LINE_PREFIX + "Copyright (C) 2010 Tony" + LINE_SEPARATOR +
+ COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + COMMENT_LINE_PREFIX + "License" +
+ LINE_SEPARATOR, boxedHeader );
- header = transformer.toString(model2);
+ header = transformer.toString( model2 );
- boxedHeader = transformer.boxComment(header, true);
+ boxedHeader = transformer.boxComment( header, true );
Assert.assertEquals(
- COMMENT_START_TAG + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "Description2" + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "License2" + LINE_SEPARATOR +
- COMMENT_END_TAG + LINE_SEPARATOR,
- boxedHeader
- );
+ COMMENT_START_TAG + LINE_SEPARATOR + COMMENT_LINE_PREFIX + "Description2" + LINE_SEPARATOR +
+ COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + COMMENT_LINE_PREFIX +
+ "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR + COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER +
+ LINE_SEPARATOR + COMMENT_LINE_PREFIX + "License2" + LINE_SEPARATOR + COMMENT_END_TAG + LINE_SEPARATOR,
+ boxedHeader );
- boxedHeader = transformer.boxComment(header, false);
+ boxedHeader = transformer.boxComment( header, false );
Assert.assertEquals(
- COMMENT_LINE_PREFIX + "Description2" + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR +
- COMMENT_LINE_PREFIX + "License2" + LINE_SEPARATOR,
- boxedHeader
- );
+ COMMENT_LINE_PREFIX + "Description2" + LINE_SEPARATOR + COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER +
+ LINE_SEPARATOR + COMMENT_LINE_PREFIX + "Copyright (C) 2010 - 2012 Tony2" + LINE_SEPARATOR +
+ COMMENT_LINE_PREFIX + DEFAULT_SECTION_DELIMITER + LINE_SEPARATOR + COMMENT_LINE_PREFIX + "License2" +
+ LINE_SEPARATOR, boxedHeader );
}
@Test
- public void testUnboxComment() throws Exception {
+ public void testUnboxComment()
+ throws Exception
+ {
String header;
String boxedHeader;
String unboxedHeader;
- header = transformer.toString(model1);
- boxedHeader = transformer.boxComment(header, true);
- unboxedHeader = transformer.unboxComent(boxedHeader);
+ header = transformer.toString( model1 );
+ boxedHeader = transformer.boxComment( header, true );
+ unboxedHeader = transformer.unboxComent( boxedHeader );
- Assert.assertEquals(header, unboxedHeader);
+ Assert.assertEquals( header, unboxedHeader );
- header = transformer.toString(model2);
- boxedHeader = transformer.boxComment(header, true);
- unboxedHeader = transformer.unboxComent(boxedHeader);
+ header = transformer.toString( model2 );
+ boxedHeader = transformer.boxComment( header, true );
+ unboxedHeader = transformer.unboxComent( boxedHeader );
- Assert.assertEquals(header, unboxedHeader);
+ Assert.assertEquals( header, unboxedHeader );
}
- public static void assertEquals(FileHeader model, FileHeader model2) {
- Assert.assertEquals(model.getDescription(), model2.getDescription());
- Assert.assertEquals(model.getCopyrightFirstYear(),
- model2.getCopyrightFirstYear());
- Assert.assertEquals(model.getCopyrightLastYear(),
- model2.getCopyrightLastYear());
- Assert.assertEquals(model.getCopyrightHolder(),
- model2.getCopyrightHolder());
- Assert.assertEquals(model.getLicense(), model2.getLicense());
+ public static void assertEquals( FileHeader model, FileHeader model2 )
+ {
+ Assert.assertEquals( model.getDescription(), model2.getDescription() );
+ Assert.assertEquals( model.getCopyrightFirstYear(), model2.getCopyrightFirstYear() );
+ Assert.assertEquals( model.getCopyrightLastYear(), model2.getCopyrightLastYear() );
+ Assert.assertEquals( model.getCopyrightHolder(), model2.getCopyrightHolder() );
+ Assert.assertEquals( model.getLicense(), model2.getLicense() );
}
}
Modified: trunk/src/test/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformerTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformerTest.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/java/org/nuiton/license/plugin/header/transformer/XmlFileHeaderTransformerTest.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -35,7 +35,8 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class XmlFileHeaderTransformerTest {
+public class XmlFileHeaderTransformerTest
+{
protected XmlFileHeaderTransformer transformer;
@@ -44,34 +45,38 @@
private static final String HEADER = "header";
@Before
- public void setUp() {
+ public void setUp()
+ {
transformer = new XmlFileHeaderTransformer();
}
@After
- public void tearDown() {
+ public void tearDown()
+ {
transformer = null;
}
@Test
- public void testAddHeaderWithNoProlog() {
+ public void testAddHeaderWithNoProlog()
+ {
String header = HEADER;
String content = CONTENT;
- String result = transformer.addHeader(header, content);
- Assert.assertEquals(header + content, result);
+ String result = transformer.addHeader( header, content );
+ Assert.assertEquals( header + content, result );
}
@Test
- public void testAddHeaderWithProlog() {
+ 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);
+ 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);
+ result = transformer.addHeader( header, content );
+ Assert.assertEquals( " " + prolog + '\n' + header + CONTENT, result );
}
}
Modified: trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/java/org/nuiton/license/plugin/model/LicenseRepositoryTest.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -38,37 +38,40 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class LicenseRepositoryTest {
+public class LicenseRepositoryTest
+{
protected LicenseRepository repository;
@Before
- public void setUp() {
+ public void setUp()
+ {
repository = null;
}
@Test
- public void testJarRepository() throws IOException {
+ public void testJarRepository()
+ throws IOException
+ {
repository = new LicenseRepository();
- URL baseURL = getClass().getResource(
- LicenseStore.JAR_LICENSE_REPOSITORY
- );
- repository.setBaseURL(baseURL);
+ URL baseURL = getClass().getResource( LicenseStore.JAR_LICENSE_REPOSITORY );
+ repository.setBaseURL( baseURL );
repository.load();
License[] licenses = repository.getLicenses();
- Assert.assertNotNull(licenses);
- Assert.assertEquals(LicenseStoreTest.DEFAULT_LICENSES.size(),
- licenses.length);
+ Assert.assertNotNull( licenses );
+ Assert.assertEquals( LicenseStoreTest.DEFAULT_LICENSES.size(), licenses.length );
- for (String licenseName : LicenseStoreTest.DEFAULT_LICENSES) {
- License license = repository.getLicense(licenseName);
- Assert.assertNotNull(license);
+ for ( String licenseName : LicenseStoreTest.DEFAULT_LICENSES )
+ {
+ License license = repository.getLicense( licenseName );
+ Assert.assertNotNull( license );
}
- for (String licenseName : repository.getLicenseNames()) {
- Assert.assertTrue(LicenseStoreTest.DEFAULT_LICENSES.contains(licenseName));
+ for ( String licenseName : repository.getLicenseNames() )
+ {
+ Assert.assertTrue( LicenseStoreTest.DEFAULT_LICENSES.contains( licenseName ) );
}
}
}
Modified: trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/java/org/nuiton/license/plugin/model/LicenseStoreTest.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -39,57 +39,53 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class LicenseStoreTest {
+public class LicenseStoreTest
+{
- public static final List<String> DEFAULT_LICENSES = Arrays.asList(
- "agpl_v3",
- "apache_v2",
- "cddl_v1",
- "fdl_v1_3",
- "gpl_v1",
- "gpl_v2",
- "gpl_v3",
- "lgpl_v2_1",
- "lgpl_v3",
- "mit"
- );
+ public static final List<String> DEFAULT_LICENSES =
+ Arrays.asList( "agpl_v3", "apache_v2", "cddl_v1", "fdl_v1_3", "gpl_v1", "gpl_v2", "gpl_v3", "lgpl_v2_1",
+ "lgpl_v3", "mit" );
protected LicenseStore store;
@Before
- public void setUp() {
+ public void setUp()
+ {
store = null;
}
@Test
- public void testJarRepository() throws IOException {
+ public void testJarRepository()
+ throws IOException
+ {
store = new LicenseStore();
store.init();
List<LicenseRepository> repositories = store.getRepositories();
- Assert.assertNotNull(repositories);
- Assert.assertEquals(1, repositories.size());
- LicenseRepository repository = repositories.get(0);
+ Assert.assertNotNull( repositories );
+ Assert.assertEquals( 1, repositories.size() );
+ LicenseRepository repository = repositories.get( 0 );
License[] licenses1 = repository.getLicenses();
License[] licenses = store.getLicenses();
- Assert.assertNotNull(licenses);
- Assert.assertNotNull(licenses1);
- Assert.assertEquals(DEFAULT_LICENSES.size(), licenses.length);
- Assert.assertEquals(DEFAULT_LICENSES.size(), licenses1.length);
+ Assert.assertNotNull( licenses );
+ Assert.assertNotNull( licenses1 );
+ Assert.assertEquals( DEFAULT_LICENSES.size(), licenses.length );
+ Assert.assertEquals( DEFAULT_LICENSES.size(), licenses1.length );
- for (String licenseName : DEFAULT_LICENSES) {
- License license = repository.getLicense(licenseName);
- License license1 = store.getLicense(licenseName);
- Assert.assertNotNull(license);
- Assert.assertNotNull(license1);
- Assert.assertEquals(license, license1);
+ for ( String licenseName : DEFAULT_LICENSES )
+ {
+ License license = repository.getLicense( licenseName );
+ License license1 = store.getLicense( licenseName );
+ Assert.assertNotNull( license );
+ Assert.assertNotNull( license1 );
+ Assert.assertEquals( license, license1 );
}
-
- for (String licenseName : store.getLicenseNames()) {
- Assert.assertTrue(LicenseStoreTest.DEFAULT_LICENSES.contains(licenseName));
+ for ( String licenseName : store.getLicenseNames() )
+ {
+ Assert.assertTrue( LicenseStoreTest.DEFAULT_LICENSES.contains( licenseName ) );
}
}
}
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/src/MyBean.java
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/src/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/addLicense/src/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: 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 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Add.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class Add {
+public class Add
+{
}
\ No newline at end of file
Modified: 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 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Fail.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class Fail {
+public class Fail
+{
}
\ No newline at end of file
Modified: 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 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Ignore.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -13,5 +13,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class Ignore {
+public class Ignore
+{
}
\ No newline at end of file
Modified: 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 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all/src/Update.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.updateFileHeaderMojoTest.all.src;
-public class Update {
+public class Update
+{
}
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/all.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- #%L
- Maven License Plugin
+<!--
+#%L
+Maven License Plugin
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit
- %%
- 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.
+$Id$
+$HeadURL$
+%%
+Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit
+%%
+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.
+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%
- -->
+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 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">
Modified: 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 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense/src/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/failLicense.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- #%L
- Maven License Plugin
+<!--
+#%L
+Maven License Plugin
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit
- %%
- 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.
+$Id$
+$HeadURL$
+%%
+Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit
+%%
+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.
+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%
- -->
+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 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">
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/src/MyBean.java
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/src/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense/src/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -13,5 +13,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/ignoreLicense.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- #%L
- Maven License Plugin
+<!--
+#%L
+Maven License Plugin
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit
- %%
- 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.
+$Id$
+$HeadURL$
+%%
+Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit
+%%
+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.
+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%
- -->
+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 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">
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/src/MyBean.java
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/src/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateFileHeaderMojoTest/updateLicense/src/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.updateFileHeaderMojoTest.updateLicense.src;
-public class MyBean {
+public class MyBean
+{
}
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -6,5 +6,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -13,5 +13,6 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.1
*/
-public class MyBean {
+public class MyBean
+{
}
\ No newline at end of file
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml 2010-11-21 13:28:04 UTC (rev 1890)
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- #%L
- Maven License Plugin
+<!--
+#%L
+Maven License Plugin
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit
- %%
- 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.
+$Id$
+$HeadURL$
+%%
+Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit
+%%
+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.
+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%
- -->
+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 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">
Modified: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java
===================================================================
--- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java 2010-11-18 21:20:17 UTC (rev 1889)
+++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java 2010-11-21 13:28:04 UTC (rev 1890)
@@ -16,5 +16,6 @@
*/
package org.nuiton.license.plugin.updateLicenseMojoTest.updateLicense.src;
-public class MyBean {
+public class MyBean
+{
}
1
0
Author: tchemit
Date: 2010-11-18 22:20:17 +0100 (Thu, 18 Nov 2010)
New Revision: 1889
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1889
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-11-18 21:20:15 UTC (rev 1888)
+++ trunk/pom.xml 2010-11-18 21:20:17 UTC (rev 1889)
@@ -38,7 +38,7 @@
</parent>
<artifactId>maven-license-plugin</artifactId>
- <version>3.0</version>
+ <version>3.1-SNAPSHOT</version>
<dependencies>
@@ -353,13 +353,13 @@
<!-- Source control management. -->
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/tags/maven-license-p…
+ scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk
</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/tags/maven-license-p…
+ scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk
</developerConnection>
<url>
- http://www.nuiton.org/repositories/browse/maven-license-plugin/tags/maven-l…
+ http://www.nuiton.org/repositories/browse/maven-license-plugin/trunk
</url>
</scm>
1
0
Author: tchemit
Date: 2010-11-18 22:20:15 +0100 (Thu, 18 Nov 2010)
New Revision: 1888
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1888
Log:
[maven-release-plugin] copy for tag maven-license-plugin-3.0
Added:
tags/maven-license-plugin-3.0/
Property changes on: tags/maven-license-plugin-3.0
___________________________________________________________________
Added: svn:ignore
+ target
.settings
.classpath
.project
*.iml
*.ipr
*.iws
Added: svn:mergeinfo
+
1
0
Author: tchemit
Date: 2010-11-18 22:20:13 +0100 (Thu, 18 Nov 2010)
New Revision: 1887
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1887
Log:
[maven-release-plugin] prepare release maven-license-plugin-3.0
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-11-18 21:08:02 UTC (rev 1886)
+++ trunk/pom.xml 2010-11-18 21:20:13 UTC (rev 1887)
@@ -23,9 +23,7 @@
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->
-<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>
@@ -40,7 +38,7 @@
</parent>
<artifactId>maven-license-plugin</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0</version>
<dependencies>
@@ -355,13 +353,13 @@
<!-- Source control management. -->
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/maven-license-plugin/trunk
+ 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/trunk
+ 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/trunk
+ http://www.nuiton.org/repositories/browse/maven-license-plugin/tags/maven-l…
</url>
</scm>
1
0
r1886 - in trunk/src: main/java/org/nuiton/license/plugin site/apt site/fr/apt
by tchemit@users.nuiton.org 18 Nov '10
by tchemit@users.nuiton.org 18 Nov '10
18 Nov '10
Author: tchemit
Date: 2010-11-18 22:08:02 +0100 (Thu, 18 Nov 2010)
New Revision: 1886
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1886
Log:
improve final doc + Anomalie #1077: When a dependency is unnamed in maven 2.x it is called unnamed and in maven 3.0, it use the artifact Id
Modified:
trunk/src/main/java/org/nuiton/license/plugin/ArtifactHelper.java
trunk/src/site/apt/index.apt
trunk/src/site/fr/apt/index.apt
Modified: trunk/src/main/java/org/nuiton/license/plugin/ArtifactHelper.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/ArtifactHelper.java 2010-11-18 20:55:41 UTC (rev 1885)
+++ trunk/src/main/java/org/nuiton/license/plugin/ArtifactHelper.java 2010-11-18 21:08:02 UTC (rev 1886)
@@ -61,7 +61,13 @@
public static String getArtifactName(MavenProject project) {
StringBuilder sb = new StringBuilder();
- sb.append(project.getName());
+ if (project.getName().startsWith("Unnamed -")) {
+
+ // as in Maven 3, let's use the artifact id
+ sb.append(project.getArtifactId());
+ }else {
+ sb.append(project.getName());
+ }
sb.append(" (");
sb.append(project.getGroupId());
sb.append(":");
Modified: trunk/src/site/apt/index.apt
===================================================================
--- trunk/src/site/apt/index.apt 2010-11-18 20:55:41 UTC (rev 1885)
+++ trunk/src/site/apt/index.apt 2010-11-18 21:08:02 UTC (rev 1886)
@@ -38,6 +38,12 @@
As planned, license descriptor was removed from project.
+ The consolidation file (called missing file) of the third-party has been improved :
+
+ - take account of special dependencies (with zip type for example)
+ - regenerate this file if needed (without using the <force> flag)
+ - delete from this file all obsolete dependencies no more used in project
+
<<Projet will migrate to Codehaus>> under the name of <<license-maven-plugin>>.
This is then the last version under this name. hope you will continue to use
Modified: trunk/src/site/fr/apt/index.apt
===================================================================
--- trunk/src/site/fr/apt/index.apt 2010-11-18 20:55:41 UTC (rev 1885)
+++ trunk/src/site/fr/apt/index.apt 2010-11-18 21:08:02 UTC (rev 1886)
@@ -39,7 +39,13 @@
Quoi de neuf dans la version 3.0
On a supprimé les fichiers de descriptions dépréciés en 2.4.
+
+ Le fichier de consolidation des third-party manquants a été amélioré :
+ - prise en compte de dépendences exotiques avec des types spéciaux (zip et autres)
+ - regénération du fichier si nécessaire
+ - suppression des dépendences qui ne sont plus utilisés dans le projet
+
<<Le projet migre sur Codehaus>> sous le nom de <<license-maven-plugin>>.
On espère que vous continurez à l'utiliser sous la forge de <<codehaus>>.
1
0
Author: tchemit
Date: 2010-11-18 21:55:41 +0100 (Thu, 18 Nov 2010)
New Revision: 1885
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1885
Log:
finalize doc
Modified:
trunk/src/site/apt/index.apt
trunk/src/site/fr/apt/index.apt
Modified: trunk/src/site/apt/index.apt
===================================================================
--- trunk/src/site/apt/index.apt 2010-11-18 20:53:20 UTC (rev 1884)
+++ trunk/src/site/apt/index.apt 2010-11-18 20:55:41 UTC (rev 1885)
@@ -143,6 +143,5 @@
* Examples
- You can find examples on how to configure and use maven-license-plugin on the
- {{{./descriptor.html}descriptor}} page
+ To come soon.
Modified: trunk/src/site/fr/apt/index.apt
===================================================================
--- trunk/src/site/fr/apt/index.apt 2010-11-18 20:53:20 UTC (rev 1884)
+++ trunk/src/site/fr/apt/index.apt 2010-11-18 20:55:41 UTC (rev 1885)
@@ -152,5 +152,4 @@
* Examples
- Vous pouez trouvez des examples sur comment configurer et utiliser
- maven-license-plugin sur la page du {{{./descriptor.html}descripteur}}.
+ A venir.
1
0
Author: tchemit
Date: 2010-11-18 21:53:20 +0100 (Thu, 18 Nov 2010)
New Revision: 1884
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1884
Log:
finalize doc
Modified:
trunk/src/site/apt/addLicense.apt
trunk/src/site/fr/apt/addLicense.apt
Modified: trunk/src/site/apt/addLicense.apt
===================================================================
--- trunk/src/site/apt/addLicense.apt 2010-11-18 20:51:17 UTC (rev 1883)
+++ trunk/src/site/apt/addLicense.apt 2010-11-18 20:53:20 UTC (rev 1884)
@@ -35,7 +35,7 @@
* Create the license files
- * src/main/licences/my_licence/header.txt
+ * src/licence/my_licence/header.txt
Example for GPLv3 :
@@ -57,7 +57,7 @@
-------------------------------------------------------------------------------
- * src/main/licences/my_licence/license.txt
+ * src/licence/my_licence/license.txt
Example for GPLv3 :
Modified: trunk/src/site/fr/apt/addLicense.apt
===================================================================
--- trunk/src/site/fr/apt/addLicense.apt 2010-11-18 20:51:17 UTC (rev 1883)
+++ trunk/src/site/fr/apt/addLicense.apt 2010-11-18 20:53:20 UTC (rev 1884)
@@ -36,7 +36,7 @@
* Créer les fichiers de license
- * src/main/licences/ma_licence/header.txt
+ * src/licence/ma_licence/header.txt
Le texte de license repris en haut de chaque fichier source.
@@ -60,7 +60,7 @@
-------------------------------------------------------------------------------
- * src/main/licences/ma_licence/license.txt
+ * src/licence/ma_licence/license.txt
Exemple pour la license GPLv3 :
1
0
Author: tchemit
Date: 2010-11-18 21:51:17 +0100 (Thu, 18 Nov 2010)
New Revision: 1883
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1883
Log:
finalize doc
Modified:
trunk/src/site/apt/addLicense.apt
trunk/src/site/fr/apt/addLicense.apt
Modified: trunk/src/site/apt/addLicense.apt
===================================================================
--- trunk/src/site/apt/addLicense.apt 2010-11-18 20:50:40 UTC (rev 1882)
+++ trunk/src/site/apt/addLicense.apt 2010-11-18 20:51:17 UTC (rev 1883)
@@ -125,7 +125,7 @@
-------------------------------------------------------------------------------
-or
+ or
-------------------------------------------------------------------------------
Modified: trunk/src/site/fr/apt/addLicense.apt
===================================================================
--- trunk/src/site/fr/apt/addLicense.apt 2010-11-18 20:50:40 UTC (rev 1882)
+++ trunk/src/site/fr/apt/addLicense.apt 2010-11-18 20:51:17 UTC (rev 1883)
@@ -128,7 +128,7 @@
-------------------------------------------------------------------------------
-ou
+ ou
-------------------------------------------------------------------------------
1
0
Author: tchemit
Date: 2010-11-18 21:50:40 +0100 (Thu, 18 Nov 2010)
New Revision: 1882
Url: http://nuiton.org/repositories/revision/maven-license-plugin/1882
Log:
finalize doc
Modified:
trunk/src/site/apt/addLicense.apt
trunk/src/site/fr/apt/addLicense.apt
Modified: trunk/src/site/apt/addLicense.apt
===================================================================
--- trunk/src/site/apt/addLicense.apt 2010-11-18 20:49:28 UTC (rev 1881)
+++ trunk/src/site/apt/addLicense.apt 2010-11-18 20:50:40 UTC (rev 1882)
@@ -90,7 +90,7 @@
* Declare the new license
The new license(s) must be declared in the file :
- src/main/licences/licenses.properties. One license per line like :
+ src/licence/licenses.properties. One license per line like :
-------------------------------------------------------------------------------
@@ -110,7 +110,7 @@
<artifactId>maven-license-plugin</artifactId>
<configuration>
<licenseName>my_licence</licenseName>
- <licenseResolver>file://${basedir}/src/licenses</licenseResolver>
+ <licenseResolver>file://${basedir}/src/license</licenseResolver>
</configuration>
<executions>
<execution>
@@ -131,7 +131,7 @@
<properties>
<license.licenseName>my_licence</license.licenseName>
- <license.licenseResolver>file://${basedir}/src/licenses</license.licenseResolver>
+ <license.licenseResolver>file://${basedir}/src/license</license.licenseResolver>
</properties>
<plugin>
Modified: trunk/src/site/fr/apt/addLicense.apt
===================================================================
--- trunk/src/site/fr/apt/addLicense.apt 2010-11-18 20:49:28 UTC (rev 1881)
+++ trunk/src/site/fr/apt/addLicense.apt 2010-11-18 20:50:40 UTC (rev 1882)
@@ -93,7 +93,7 @@
* Déclarer la nouvelle license
La(les) nouvelle(s) license(s) doit être déclarée dans le fichier
- src/main/licences/licenses.properties. Une license par ligne :
+ src/licence/licenses.properties. Une license par ligne :
-------------------------------------------------------------------------------
@@ -113,7 +113,7 @@
<artifactId>maven-license-plugin</artifactId>
<configuration>
<licenseName>my_licence</licenseName>
- <licenseResolver>file://${basedir}/src/licenses</licenseResolver>
+ <licenseResolver>file://${basedir}/src/license</licenseResolver>
</configuration>
<executions>
<execution>
@@ -134,7 +134,7 @@
<properties>
<license.licenseName>my_licence</license.licenseName>
- <license.licenseResolver>file://${basedir}/src/licenses</license.licenseResolver>
+ <license.licenseResolver>file://${basedir}/src/license</license.licenseResolver>
</properties>
<plugin>
1
0