r1809 - in trunk: . src/it src/it/ano-816 src/it/ano-816/child1 src/it/ano-816/child2 src/main/java/org/nuiton/license/plugin
Author: tchemit Date: 2010-08-30 00:02:21 +0200 (Mon, 30 Aug 2010) New Revision: 1809 Url: http://nuiton.org/repositories/revision/maven-license-plugin/1809 Log: Anomalie #816: Check if the License object is well formed Anomalie #842: In maven 3, do not requires encoding in add-third-party mojos Added: trunk/src/it/ano-816/ trunk/src/it/ano-816/child1/ trunk/src/it/ano-816/child1/pom.xml trunk/src/it/ano-816/child2/ trunk/src/it/ano-816/child2/pom.xml trunk/src/it/ano-816/invoker.properties trunk/src/it/ano-816/pom.xml trunk/src/it/ano-816/verify.groovy Modified: trunk/pom.xml trunk/src/main/java/org/nuiton/license/plugin/AbstractAddThirdPartyMojo.java trunk/src/main/java/org/nuiton/license/plugin/LicenseMap.java Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-08-29 14:20:30 UTC (rev 1808) +++ trunk/pom.xml 2010-08-29 22:02:21 UTC (rev 1809) @@ -426,6 +426,7 @@ <artifactId>maven-invoker-plugin</artifactId> <configuration> <pomIncludes> + <pomInclude>ano-816/pom.xml</pomInclude> <pomInclude>add-third-party/no-encoding/pom.xml</pomInclude> <pomInclude>aggregate-add-third-party/pom.xml</pomInclude> <pomInclude>add-third-party/merge-licenses/pom.xml</pomInclude> Added: trunk/src/it/ano-816/child1/pom.xml =================================================================== --- trunk/src/it/ano-816/child1/pom.xml (rev 0) +++ trunk/src/it/ano-816/child1/pom.xml 2010-08-29 22:02:21 UTC (rev 1809) @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.nuiton.license.test</groupId> + <artifactId>test-it-816</artifactId> + <version>1.0</version> + </parent> + <artifactId>test-it-816-child1</artifactId> + + <licenses> + <license> + <name><!--fake license with no name--></name> + </license> + <license> + <name> </name> + </license> + <license> + <name> </name> + <url><!-- fake license with no name nor url--></url> + </license> + <license> + <name> </name> + <url> </url> + </license> + </licenses> + <name>License Test :: ano-816 - child 1</name> + +</project> + + Property changes on: trunk/src/it/ano-816/child1/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/src/it/ano-816/child2/pom.xml =================================================================== --- trunk/src/it/ano-816/child2/pom.xml (rev 0) +++ trunk/src/it/ano-816/child2/pom.xml 2010-08-29 22:02:21 UTC (rev 1809) @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.nuiton.license.test</groupId> + <artifactId>test-it-816</artifactId> + <version>1.0</version> + </parent> + <artifactId>test-it-816-child2</artifactId> + + <licenses> + <license> + <name><!--fake license with no url--></name> + </license> + </licenses> + <name>License Test :: ano-816 - child 2</name> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>test-it-816-child1</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project> + + Property changes on: trunk/src/it/ano-816/child2/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/src/it/ano-816/invoker.properties =================================================================== --- trunk/src/it/ano-816/invoker.properties (rev 0) +++ trunk/src/it/ano-816/invoker.properties 2010-08-29 22:02:21 UTC (rev 1809) @@ -0,0 +1,21 @@ +# A comma or space separated list of goals/phases to execute, may +# specify an empty list to execute the default goal of the IT project +invoker.goals=install license:aggregate-add-third-party + +# Optionally, a list of goals to run during further invocations of Maven +#invoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:run + +# A comma or space separated list of profiles to activate +#invoker.profiles=run-all run-once + +# The value for the environment variable MAVEN_OPTS +#invoker.mavenOpts=-Dfile.encoding=UTF-16 -Xms32m -Xmx256m + +# Possible values are "fail-fast" (default), "fail-at-end" and "fail-never" +invoker.failureBehavior=fail-at-end + +# The expected result of the build, possible values are "success" (default) and "failure" +#invoker.buildResult=success + +# A boolean value controlling the -N flag, defaults to "false" +#invoker.nonRecursive=false Property changes on: trunk/src/it/ano-816/invoker.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/src/it/ano-816/pom.xml =================================================================== --- trunk/src/it/ano-816/pom.xml (rev 0) +++ trunk/src/it/ano-816/pom.xml 2010-08-29 22:02:21 UTC (rev 1809) @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <groupId>org.nuiton.license.test</groupId> + <artifactId>test-it-816</artifactId> + <version>1.0</version> + + <modules> + <module>child1</module> + <module>child2</module> + </modules> + + <name>License Test :: ano-816</name> + + <packaging>pom</packaging> + + <url>no-url</url> + <properties> + + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <!--<license.generateBundle>true</license.generateBundle>--> + <license.verbose>true</license.verbose> + </properties> + + <build> + + <pluginManagement> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <version>@pom.version@</version> + </plugin> + </plugins> + </pluginManagement> + </build> + +</project> + + Property changes on: trunk/src/it/ano-816/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/src/it/ano-816/verify.groovy =================================================================== --- trunk/src/it/ano-816/verify.groovy (rev 0) +++ trunk/src/it/ano-816/verify.groovy 2010-08-29 22:02:21 UTC (rev 1809) @@ -0,0 +1,8 @@ + +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)' ); + +return true; Property changes on: trunk/src/it/ano-816/verify.groovy ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/src/main/java/org/nuiton/license/plugin/AbstractAddThirdPartyMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AbstractAddThirdPartyMojo.java 2010-08-29 14:20:30 UTC (rev 1808) +++ trunk/src/main/java/org/nuiton/license/plugin/AbstractAddThirdPartyMojo.java 2010-08-29 22:02:21 UTC (rev 1809) @@ -164,7 +164,11 @@ * property {@code file.encoding}. * * @parameter expression="${license.encoding}" default-value="${project.build.sourceEncoding}" - * @required + * + * tchemit 2010-08-29 Ano #842 + * In maven 3, it will not pass if nothing was filled in project.build.sourceEncoding, + * As we have a futher fallback for this case we do not need to be required here. + * //@required * @since 2.1 */ private String encoding; Modified: trunk/src/main/java/org/nuiton/license/plugin/LicenseMap.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/LicenseMap.java 2010-08-29 14:20:30 UTC (rev 1808) +++ trunk/src/main/java/org/nuiton/license/plugin/LicenseMap.java 2010-08-29 22:02:21 UTC (rev 1809) @@ -90,15 +90,26 @@ } for (Object o : licenses) { + String id; + id = AbstractAddThirdPartyMojo.getArtifactId(project.getArtifact()); if (o == null) { - getLog().warn("could not acquire the license for " + AbstractAddThirdPartyMojo.getArtifactId(project.getArtifact())); + getLog().warn("could not acquire the license for " + id); continue; } License license = (License) o; String licenseKey = license.getName(); - if (license.getName() == null) { + + // 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); licenseKey = license.getUrl(); } + + if (StringUtils.isEmpty(licenseKey)) { + getLog().warn("No license url defined for " + id); + licenseKey = getUnknownLicenseMessage(); + } put(licenseKey, project); } }
participants (1)
-
tchemit@users.nuiton.org