Author: ymartel Date: 2010-09-24 16:14:01 +0200 (Fri, 24 Sep 2010) New Revision: 1824 Url: http://nuiton.org/repositories/revision/maven-license-plugin/1824 Log: Add integration test about filters on thirdParty aggregation in multimodule Added: trunk/src/it/evo-818-multimodule-filters/ trunk/src/it/evo-818-multimodule-filters/child1/ trunk/src/it/evo-818-multimodule-filters/child1/pom.xml trunk/src/it/evo-818-multimodule-filters/child2/ trunk/src/it/evo-818-multimodule-filters/child2/pom.xml trunk/src/it/evo-818-multimodule-filters/invoker.properties trunk/src/it/evo-818-multimodule-filters/pom.xml trunk/src/it/evo-818-multimodule-filters/verify.groovy Modified: trunk/pom.xml trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyMojo.java Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-09-24 12:09:25 UTC (rev 1823) +++ trunk/pom.xml 2010-09-24 14:14:01 UTC (rev 1824) @@ -429,7 +429,8 @@ <artifactId>maven-invoker-plugin</artifactId> <configuration> <pomIncludes> - <pomInclude>evo-818-excluded-included/pom.xml</pomInclude> + <pomInclude>evo-818-excluded-included</pomInclude> + <pomInclude>evo-818-multimodule-filters/pom.xml</pomInclude> <pomInclude>ano-816/pom.xml</pomInclude> <pomInclude>add-third-party/no-encoding/pom.xml</pomInclude> <pomInclude>aggregate-add-third-party/pom.xml</pomInclude> Added: trunk/src/it/evo-818-multimodule-filters/child1/pom.xml =================================================================== --- trunk/src/it/evo-818-multimodule-filters/child1/pom.xml (rev 0) +++ trunk/src/it/evo-818-multimodule-filters/child1/pom.xml 2010-09-24 14:14:01 UTC (rev 1824) @@ -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>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> + +</project> + + Added: trunk/src/it/evo-818-multimodule-filters/child2/pom.xml =================================================================== --- trunk/src/it/evo-818-multimodule-filters/child2/pom.xml (rev 0) +++ trunk/src/it/evo-818-multimodule-filters/child2/pom.xml 2010-09-24 14:14:01 UTC (rev 1824) @@ -0,0 +1,37 @@ +<?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>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> + + <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> + + Added: trunk/src/it/evo-818-multimodule-filters/invoker.properties =================================================================== --- trunk/src/it/evo-818-multimodule-filters/invoker.properties (rev 0) +++ trunk/src/it/evo-818-multimodule-filters/invoker.properties 2010-09-24 14:14:01 UTC (rev 1824) @@ -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=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 Added: trunk/src/it/evo-818-multimodule-filters/pom.xml =================================================================== --- trunk/src/it/evo-818-multimodule-filters/pom.xml (rev 0) +++ trunk/src/it/evo-818-multimodule-filters/pom.xml 2010-09-24 14:14:01 UTC (rev 1824) @@ -0,0 +1,62 @@ +<?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>evo-818-multimodule</artifactId> + <version>1.0</version> + + <modules> + <module>child1</module> + <module>child2</module> + </modules> + + <name>Evo 818 : test MultiModule</name> + + <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> + + <build> + + <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> + + </build> + +</project> + + Added: trunk/src/it/evo-818-multimodule-filters/verify.groovy =================================================================== --- trunk/src/it/evo-818-multimodule-filters/verify.groovy (rev 0) +++ trunk/src/it/evo-818-multimodule-filters/verify.groovy 2010-09-24 14:14:01 UTC (rev 1824) @@ -0,0 +1,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( '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/main/java/org/nuiton/license/plugin/AddThirdPartyMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyMojo.java 2010-09-24 12:09:25 UTC (rev 1823) +++ trunk/src/main/java/org/nuiton/license/plugin/AddThirdPartyMojo.java 2010-09-24 14:14:01 UTC (rev 1824) @@ -142,19 +142,19 @@ } String id = getArtifactId(artifact); - MavenProject project = addArtifact(id, artifact); // Check if the project should be included // If there is no specified artifacts and group to include, include all boolean isToInclude = haveNoIncludedArtifacts && haveNoIncludedGroups - || isIncludable(project, includedGroupPattern, includedArtifactPattern); + || isIncludable(artifact, includedGroupPattern, includedArtifactPattern); // Check if the project should be excluded boolean isToExclude = isToInclude && haveExclusions - && isExcludable(project, excludedGroupPattern, excludedArtifactPattern); + && isExcludable(artifact, excludedGroupPattern, excludedArtifactPattern); if (isToInclude && !isToExclude) { + MavenProject project = addArtifact(id, artifact); licenseMap.addLicense(project, project.getLicenses()); } } @@ -285,7 +285,7 @@ } - protected boolean isIncludable(MavenProject project, + protected boolean isIncludable(Artifact project, Pattern includedGroupPattern, Pattern includedArtifactPattern) { @@ -331,7 +331,7 @@ } - protected boolean isExcludable(MavenProject project, + protected boolean isExcludable(Artifact project, Pattern excludedGroupPattern, Pattern excludedArtifactPattern) {