org.codehaus.mojo.license.third-party-file-groupByLicense.ftl Maven / Gradle / Ivy
<#--
#%L
License Maven Plugin
%%
Copyright (C) 2012 Codehaus, Tony Chemit
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Lesser Public License for more details.
You should have received a copy of the GNU General Lesser Public
License along with this program. If not, see
.
#L%
-->
<#-- To render the third-party file.
Available context :
- dependencyMap a collection of Map.Entry with
key are dependencies (as a MavenProject) (from the maven project)
values are licenses of each dependency (array of string)
- licenseMap a collection of Map.Entry with
key are licenses of each dependency (array of string)
values are all dependencies using this license
-->
<#function artifactFormat p>
<#if p.name?index_of('Unnamed') > -1>
<#return p.artifactId + " (" + p.groupId + ":" + p.artifactId + ":" + p.version + " - " + (p.url!"no url defined") + ")">
<#else>
<#return p.name + " (" + p.groupId + ":" + p.artifactId + ":" + p.version + " - " + (p.url!"no url defined") + ")">
#if>
#function>
<#if licenseMap?size == 0>
The project has no dependencies.
<#else>
List of third-party dependencies grouped by their license type.
<#list licenseMap as e>
<#assign license = e.getKey()/>
<#assign projects = e.getValue()/>
<#if projects?size > 0>
${license}:
<#list projects as project>
* ${artifactFormat(project)}
#list>
#if>
#list>
#if>