History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: MPANT-23
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Arnaud Heritier
Reporter: Phil Steitz
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Maven 1.x Ant Plugin

Add License file to jar META-INF

Created: 11/Jan/05 11:39 PM   Updated: 26/Feb/05 08:53 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.9

Time Tracking:
Not Specified

File Attachments: 1. Text File antPlugin2.patch (0.9 kb)
2. File antPluginPatch (1 kb)



 Description  « Hide
The maven jar plugin automatically adds license files to jar META-INF. The Ant plugin can be made to generate a build.xml that does this by including this file as a resource with targetpath META-INF, but this causes the maven jar task to insert two copies of the file.

It would be great if the ant plugin generated a build.xml that does the same thing that the maven jar task does. I am attaching a patch that works if the url property of licenses in the POM is a relative local path reference to the license file. I could not figure out how to canonicalize the file path as the jar plugin appears to do.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
dion gillard - 16/Jan/05 06:46 PM
Hmmm...

the license/url element is not supposed to be used for a file in this way AFAIK.

The jar plugin does this:

<j:set var="licenseFileName"><license:fileName/></j:set>
<util:file name="${licenseFileName}" var="licenseFile"/>
<ant:metainf dir="${licenseFile.canonicalFile.parent}">
<ant:include name="${licenseFile.canonicalFile.name}"/>
</ant:metainf>

Which uses ${maven.license.licenseFile} and defaults to ${basedir}/LICENSE.txt.

We could use the <license:relativeFileName /> tag to get the license file relative to ${basedir} for the Ant plugin.

Whaddya think?


Phil Steitz - 16/Jan/05 09:11 PM
Defintely looks better. I did not know of maven.license.licenseFile and was incorrectly thinking that it was related to the licenses element in the POM.

Phil Steitz - 17/Jan/05 01:45 AM
This patch use maven.license.licenseFile to locate the license file. It should be improved to somehow handle the case where there is no license file, since if nothing is specified it will default to ${basedir}/LICENSE.txt and add a copy directive for that, which will cause the ant build to fail.

Arnaud Heritier - 26/Feb/05 08:53 PM
Applied. thanks