Commit d9d9292c authored by Matija Obreza's avatar Matija Obreza

Third-party license information

parent b43847c9
......@@ -15,7 +15,9 @@
limitations under the License.
-->
<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/xsd/maven-4.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/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<groupId>org.genesys-pgr</groupId>
......@@ -720,6 +722,30 @@
</attributes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.9</version>
<executions>
<execution>
<id>license-download</id>
<phase>generate-resources</phase>
<goals>
<goal>download-licenses</goal>
</goals>
</execution>
<execution>
<id>license-third-party</id>
<phase>generate-sources</phase>
<goals>
<goal>add-third-party</goal>
</goals>
</execution>
</executions>
<configuration>
<sortArtifactByName>true</sortArtifactByName>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
......@@ -733,6 +759,10 @@
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
......
/*
* Copyright 2016 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys2.server.test;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
public class LicensesTest {
@Test
public void test3rdPartyRead() throws IOException {
try (InputStream is = getClass().getClassLoader().getResourceAsStream("THIRD-PARTY.txt")) {
String thirdParty = IOUtils.toString(is, Charset.forName("UTF8"));
assertThat("THIRD-PARTY.txt could not be read", thirdParty, not(nullValue()));
Pattern licenseInfo = Pattern.compile("^ {5}\\(((?:\\([^\\)]+\\)|[^\\)])+)\\) (\\(.+\\) )*(.+) \\((.+):(.+):(.+) \\- (.+)\\)$", Pattern.MULTILINE);
Matcher m = licenseInfo.matcher(thirdParty);
while (m.find()) {
String license = m.group(1);
String license2 = m.group(2);
String project = m.group(3);
String groupId = m.group(4);
String artifactId = m.group(5);
String version = m.group(6);
String url = m.group(7);
System.err.println(project + " url=" + url + " license=" + license + " art=" + artifactId + "@" + version);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment