Skip to content

Commit

Permalink
Merge pull request #266 from ppalaga/i265
Browse files Browse the repository at this point in the history
Fix #265 Let AbstractDownloadLicensesMojo.licensesConfigFile match by…
  • Loading branch information
ppalaga authored Feb 20, 2019
2 parents 9ae1c6b + b50a2aa commit 57d7c1e
Show file tree
Hide file tree
Showing 32 changed files with 1,227 additions and 371 deletions.
4 changes: 2 additions & 2 deletions src/it/PR-32/child1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<artifactId>PR-32-child1</artifactId>
<licenses>
<license>
<name>LGPL 3.0</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

Expand Down
10 changes: 5 additions & 5 deletions src/it/PR-32/postbuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* #L%
*/

def lgpl3 = new File(basedir, 'child2/target/generated-resources/licenses/lgpl 3.0 - lgpl-3.0.txt')
assert lgpl3.exists()
assert lgpl3.text.contains('GNU LESSER GENERAL PUBLIC LICENSE');
def asl2 = new File(basedir, 'child2/target/generated-resources/licenses/apache license 2.0 - license-2.0.txt')
assert asl2.exists()
assert asl2.text.contains('Version 2.0, January 2004');

def licensesXml = new File(basedir, 'child2/target/generated-resources/licenses.xml');
assert licensesXml.exists()
assert licensesXml.text.contains('<file>lgpl 3.0 - lgpl-3.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>')
assert licensesXml.text.contains('<file>apache license 2.0 - license-2.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>')
4 changes: 2 additions & 2 deletions src/it/PR-33/child1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<artifactId>PR-33-child1</artifactId>
<licenses>
<license>
<name>LGPL 2.1</name>
<url>https://www.gnu.org/licenses/lgpl-2.1.txt</url>
<name>Apache License 1.0</name>
<url>https://www.apache.org/licenses/LICENSE-1.0</url>
</license>
</licenses>

Expand Down
4 changes: 2 additions & 2 deletions src/it/PR-33/child2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<artifactId>PR-33-child2</artifactId>
<licenses>
<license>
<name>LGPL 3.0</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
</project>
36 changes: 10 additions & 26 deletions src/it/PR-33/postbuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,18 @@
* #L%
*/

def assertExistsFile(file) {
if (!file.exists() || file.isDirectory()) {
println(file.getAbsolutePath() + " file is missing or a directory.")
assert false
}
assert true
}

def assertContains(file, content, expected) {
if (!content.contains(expected)) {
println(expected + " was not found in file [" + file + "]\n :" + content)
return false
}
return true
}
def asl2 = new File(basedir, 'child3/target/generated-resources/licenses/org.codehaus.mojo.license.test.pr-33-child2_apache_license_2.0.txt')
assert asl2.exists()
assert asl2.text.contains('Version 2.0, January 2004');


def lgpl3 = new File(basedir, 'child3/target/generated-resources/licenses/org.codehaus.mojo.license.test.pr-33-child1_lgpl_2.1.txt')
assert lgpl3.exists()
assert lgpl3.text.contains('Version 2.1, February 1999');

def lgpl21 = new File(basedir, 'child3/target/generated-resources/licenses/org.codehaus.mojo.license.test.pr-33-child2_lgpl_3.0.txt')
assert lgpl21.exists()
assert lgpl21.text.contains('Version 3, 29 June 2007');
def asl1 = new File(basedir, 'child3/target/generated-resources/licenses/org.codehaus.mojo.license.test.pr-33-child1_apache_license_1.0.txt')
assert asl1.exists()
assert asl1.text.contains('Copyright (c) 1995-1999 The Apache Group.');

def licensesXml = new File(basedir, 'child3/target/generated-resources/licenses.xml');
assert licensesXml.exists()
assert licensesXml.text.contains('<file>org.codehaus.mojo.license.test.pr-33-child1_lgpl_2.1.txt</file>')
assert licensesXml.text.contains('<url>https://www.gnu.org/licenses/lgpl-2.1.txt</url>')
assert licensesXml.text.contains('<file>org.codehaus.mojo.license.test.pr-33-child2_lgpl_3.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>')
assert licensesXml.text.contains('<file>org.codehaus.mojo.license.test.pr-33-child2_apache_license_2.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>')
assert licensesXml.text.contains('<file>org.codehaus.mojo.license.test.pr-33-child1_apache_license_1.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.apache.org/licenses/LICENSE-1.0</url>')

This file was deleted.

14 changes: 0 additions & 14 deletions src/it/download-licenses-configured-alt-location/licenses.xml

This file was deleted.

40 changes: 0 additions & 40 deletions src/it/download-licenses-configured-alt-location/pom.xml

This file was deleted.

48 changes: 0 additions & 48 deletions src/it/download-licenses-configured-alt-location/postbuild.groovy

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion src/it/download-licenses-configured/invoker.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invoker.goals = clean license:download-licenses
invoker.goals = clean validate
39 changes: 39 additions & 0 deletions src/it/download-licenses-configured/licenses-pre-1.18.expected.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<licenseSummary>
<dependencies>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
<licenses>
<license>
<name>Public Domain</name>
</license>
</licenses>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.1</version>
<licenses>
<license>
<name>BSD 3-Clause ASM</name>
<url>https://gitlab.ow2.org/asm/asm/raw/ASM_3_1_MVN/LICENSE.txt</url>
<file>bsd 3-clause asm - license.txt</file>
</license>
</licenses>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0</version>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<file>apache license 2.0 - license-2.0.txt</file>
</license>
</licenses>
</dependency>
</dependencies>
</licenseSummary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<licenseSummary>
<dependencies>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
<licenses>
<license>
<name>Public Domain</name>
</license>
</licenses>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.1</version>
<licenses>
<license>
<name>BSD 3-Clause ASM</name>
<url>https://gitlab.ow2.org/asm/asm/raw/ASM_3_1_MVN/LICENSE.txt</url>
<file>bsd 3-clause asm - license.txt</file>
</license>
</licenses>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0</version>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<file>apache license 2.0 - license-2.0.txt</file>
</license>
</licenses>
</dependency>
</dependencies>
</licenseSummary>
31 changes: 31 additions & 0 deletions src/it/download-licenses-configured/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
<artifactId>commons-logging</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.1</version>
</dependency>
</dependencies>

<build>
Expand All @@ -29,9 +39,30 @@
<version>@pom.version@</version>
<executions>
<execution>
<id>pre-1.18</id>
<phase>validate</phase>
<goals>
<goal>download-licenses</goal>
</goals>
<configuration>
<licensesConfigFile>${basedir}/src/license/licenses-config-pre-1.18.xml</licensesConfigFile>
<licensesOutputDirectory>${project.build.directory}/pre-1.18/licenses</licensesOutputDirectory>
<licensesOutputFile>${project.build.directory}/pre-1.18/licenses.xml</licensesOutputFile>
<sortByGroupIdAndArtifactId>true</sortByGroupIdAndArtifactId>
</configuration>
</execution>
<execution>
<id>since-1.18</id>
<phase>validate</phase>
<goals>
<goal>download-licenses</goal>
</goals>
<configuration>
<licensesConfigFile>${basedir}/src/license/licenses-config-since-1.18.xml</licensesConfigFile>
<licensesOutputDirectory>${project.build.directory}/since-1.18/licenses</licensesOutputDirectory>
<licensesOutputFile>${project.build.directory}/since-1.18/licenses.xml</licensesOutputFile>
<sortByGroupIdAndArtifactId>true</sortByGroupIdAndArtifactId>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Loading

0 comments on commit 57d7c1e

Please sign in to comment.