Permalink
Browse files

Generate 3rd party dependency license report and make it visible from

the UI.

Also, for the core build, require that all the dependency licenses are
available.
  • Loading branch information...
kohsuke committed Apr 15, 2011
1 parent 2eae2b1 commit 0ae70779bebf8bf7da38f5ea4438f08ab0458942
View
@@ -225,6 +225,13 @@ THE SOFTWARE.
</dependency>
</dependencies>
</plugin>
+ <plugin><!-- generate licenses.xml -->
+ <groupId>com.cloudbees</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <generateLicenseXml>target/classes/META-INF/licenses.xml</generateLicenseXml>
+ </configuration>
+ </plugin>
</plugins>
</build>
@@ -397,6 +397,15 @@ public String getPluginClass() {
return manifest.getMainAttributes().getValue("Plugin-Class");
}
+ public boolean hasLicensesXml() {
+ try {
+ new URL(baseResourceURL,"WEB-INF/licenses.xml").openStream().close();
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
/**
* Makes sure that all the dependencies exist, and then accept optional dependencies
* as real dependencies.
@@ -67,7 +67,9 @@ THE SOFTWARE.
</div>
</td>
<td class="center pane" style="white-space:nowrap">
- ${p.version}
+ <a href="plugin/${p.shortName}/3rdPartyLicenses">
+ ${p.version}
+ </a>
</td>
<td>
<j:if test="${p.downgradable}">
@@ -0,0 +1,44 @@
+<!--
+The MIT License
+
+Copyright (c) 2011, CloudBees, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+-->
+
+<!-- 3rd party license acknowledgements and -->
+<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form">
+ <l:layout title="${%about(it.longName)}">
+ <l:main-panel>
+ <h1>${%about(it.longName+' '+it.version)}</h1>
+
+ <h3>${%3rd Party Dependencies}</h3>
+ <t:3rdPartyLicenses>
+ <j:choose>
+ <j:when test="${it.hasLicensesXml()}">
+ <j:include uri="${it.baseResourceURL}/WEB-INF/licenses.xml" />
+ </j:when>
+ <j:otherwise>
+ <p>${%No information recorded}</p>
+ </j:otherwise>
+ </j:choose>
+ </t:3rdPartyLicenses>
+ </l:main-panel>
+ </l:layout>
+</j:jelly>
@@ -0,0 +1,43 @@
+<!--
+The MIT License
+
+Copyright (c) 2011, CloudBees, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+-->
+
+<!-- 3rd party license acknowledgements and -->
+<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form">
+ <l:layout title="${%about(it.VERSION)}">
+ <st:include page="sidepanel.jelly" />
+ <l:main-panel>
+ <h1>${%about(it.VERSION)}</h1>
+ <p>
+ ${%blurb}
+ </p>
+
+ <p>
+ ${%dependencies}
+ </p>
+ <t:3rdPartyLicenses>
+ <st:include page="/META-INF/licenses.xml" />
+ </t:3rdPartyLicenses>
+ </l:main-panel>
+ </l:layout>
+</j:jelly>
@@ -0,0 +1,4 @@
+about=About Jenkins {0}
+blurb=<a href="http://jenkins-ci.org/">Jenkins</a> is a community-developed open-source continuous integration server.
+
+dependencies=Jenkins depends on the following 3rd party libraries.
@@ -0,0 +1,57 @@
+<!--
+The MIT License
+
+Copyright (c) 2011, CloudBees, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+-->
+
+<!-- 3rd party license acknowledgements and -->
+<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form">
+ <d:taglib uri="licenses">
+ <d:tag name="dependencies">
+ <table class="pane sortable bigtable">
+ <tr>
+ <th class="pane-header">${%Name}</th>
+ <th class="pane-header">${%Maven ID}</th>
+ <th class="pane-header">${%License}</th>
+ </tr>
+ <d:invokeBody/>
+ </table>
+ </d:tag>
+ <d:tag name="dependency">
+ <tr>
+ <td>
+ <a href="${attrs.url}">${attrs.name}</a>
+ </td>
+ <td>
+ ${attrs.groupId}:${attrs.artifactId}:${attrs.version}
+ </td>
+ <td>
+ <d:invokeBody />
+ </td>
+ </tr>
+ </d:tag>
+ <d:tag name="description"/>
+ <d:tag name="license">
+ <a href="${attrs.url}">${attrs.name}</a><br/>
+ </d:tag>
+ </d:taglib>
+ <d:invokeBody/>
+</j:jelly>
View
@@ -0,0 +1,92 @@
+
+def apacheLicense = license("The Apache Software License, Version 2.0","http://www.apache.org/licenses/LICENSE-2.0.txt")
+def cddl = license("CDDL","http://www.sun.com/cddl/")
+def lgpl = license("LGPL 2.1","http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html")
+def mitLicense = license("MIT License","http://www.opensource.org/licenses/mit-license.php")
+def jenkinsLicense = license("MIT License","http://jenkins-ci.org/mit-license")
+
+
+match("asm:*") {
+ rewriteLicense([], license("BSD License","http://asm.ow2.org/license.html"))
+}
+
+// Apache components
+// logkit is a part of Avalon
+match(["org.apache.ant:*","commons-jelly:*","log4j:*","avalon-framework:*","logkit:logkit","oro:oro","org.jvnet.hudson:commons-jelly","org.jvnet.hudson:commons-jelly-tags-define","slide:slide-webdavlib"]) {
+ rewriteLicense([], apacheLicense)
+}
+
+// GlassFish components are dual-licensed between CDDL and GPL+Classpath Exception
+// we elect to take them under CDDL.
+match(["javax.mail:*","org.jvnet.hudson:activation","org.jvnet:tiger-types","javax.servlet:jstl"]) {
+ rewriteLicense([], cddl)
+}
+
+match("antlr:*") {
+ rewriteLicense([], license("BSD License","http://www.antlr.org/license.html"))
+}
+
+match("jaxen:jaxen") {
+ rewriteLicense([], license("BSD License","http://jaxen.codehaus.org/license.html"))
+}
+
+match("args4j:args4j") {
+ rewriteLicense([], mitLicense)
+}
+
+match("*:dom4j") {
+ rewriteLicense([],license("BSD License","http://dom4j.sourceforge.net/dom4j-1.6.1/license.html"))
+}
+
+match(["org.codehaus.groovy:*"]) {
+ // see http://groovy.codehaus.org/License+Information
+ // see http://jmdns.sourceforge.net/license.html
+ rewriteLicense([],apacheLicense)
+}
+
+match("*:stapler-adjunct-timeline") {
+ rewriteLicense([],license("BSD License","http://simile.mit.edu/license.html"))
+}
+
+match("*:txw2") {
+ // see http://java.net/projects/jaxb/sources/version2/content/trunk/txw2/license.txt?rev=3611
+ rewriteLicense([],cddl)
+}
+
+match(["org.kohsuke.jinterop:j-interop","org.kohsuke.jinterop:j-interopdeps"]) {
+ rewriteLicense([],license("LGPL v3","http://www.j-interop.org/license.html"))
+}
+
+// these are our own modules that have license in the trunk but not in these released versions
+// as we upgrade them, we should just pick up the license info from POM
+match(["org.jenkins-ci.modules:instance-identity","org.jvnet.hudson:task-reactor","org.jvnet.hudson:annotation-indexer","*:jinterop-wmi","*:maven2.1-interceptor","*:hudson-maven-embedder"]) {
+ rewriteLicense([],jenkinsLicense)
+}
+
+match("*:jna") {
+ rewriteLicense([],lgpl)
+}
+
+match(["org.jvnet.localizer:localizer","*:trilead-putty-extension"]) {
+ // see http://java.net/projects/localizer
+ // see http://java.net/projects/trilead-putty-extension/
+ rewriteLicense([],mitLicense);
+}
+
+match("org.codehaus.plexus:plexus-interactivity-api") {
+ rewriteLicense([],mitLicense)
+}
+
+match("de.zeigermann.xml:xml-im-exporter:1.1") {
+ rewriteLicense([],license("BSD License","http://xml-im-exporter.cvs.sourceforge.net/viewvc/xml-im-exporter/xml-im-exporter/Copying.txt?revision=1.3&view=markup"))
+}
+
+
+
+//
+// Choose from multi-licensed modules
+//==========================================================================
+
+match("*:jna-posix") {
+ accept("GNU Lesser General Public License Version 2.1")
+}
View
@@ -193,7 +193,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.lib</groupId>
<artifactId>lib-jenkins-maven-artifact-manager</artifactId>
- <version>1.1</version>
+ <version>1.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
@@ -288,13 +288,20 @@ THE SOFTWARE.
<goals>
<goal>generate</goal>
</goals>
- <configuration>
+ <configuration>
<fileMask>Messages.properties</fileMask>
<outputDirectory>target/generated-sources/localizer</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
+ <plugin><!-- generate licenses.xml -->
+ <groupId>com.cloudbees</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <generateLicenseXml>target/${project.artifactId}/WEB-INF/licenses.xml</generateLicenseXml>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
<artifactId>maven-antrun-extended-plugin</artifactId>
View
17 pom.xml
@@ -161,6 +161,23 @@ THE SOFTWARE.
</dependency>
</dependencies>
</plugin>
+ <plugin>
+ <groupId>com.cloudbees</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <phase>compile</phase>
+ <configuration>
+ <requireCompleteLicenseInfo>true</requireCompleteLicenseInfo>
+ <completer>../licenseCompleter.groovy</completer>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</pluginManagement>

0 comments on commit 0ae7077

Please sign in to comment.