Skip to content

Instantly share code, notes, and snippets.

@williamchan
Created December 9, 2015 21:24
Show Gist options
  • Save williamchan/ebe74ecf59df73580c24 to your computer and use it in GitHub Desktop.
Save williamchan/ebe74ecf59df73580c24 to your computer and use it in GitHub Desktop.
Format for third-party file returned by License Maven Plugin
<#-- For formatting third-party file returned by License Maven Plugin.
Format is semicolon-delimited: license; name; groupId; artifactId; version; url
-->
<#function licenseFormat licenses>
<#assign result = ""/>
<#list licenses as license>
<#assign result = result + license/>
</#list>
<#assign result = result + ";"/>
<#return result>
</#function>
<#function artifactFormat p>
<#if p.name?index_of('Unnamed') &gt; -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 dependencyMap?size == 0>
The project has no dependencies.
<#else>
<#list dependencyMap as e>
<#assign project = e.getKey()/>
<#assign licenses = e.getValue()/>
${licenseFormat(licenses)} ${artifactFormat(project)}
</#list>
</#if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment