On Aug 11, 2010, at 4:49 AM, Manfred Bergmann wrote:
>
>
> Steve Appling wrote:
>>
>>
>> On Aug 10, 2010, at 10:04 AM, Bergmann Manfred wrote:
>>
>>> Hi.
>>>
>>> The following task:
>>> task myjar(dependsOn:enhance) << {
>>> def destFile = "build/libs/${project.name}-${version}-myjar.jar"
>>> ant.delete(file:destFile)
>>> ant.mkdir(dir:'build/libs')
>>> ant.jar(destfile:destFile) {
>>> manifest() {
>>> attribute(name:"Specification-Title", value:"${project.name}")
>>> attribute(name:"Specification-Version", value:"${version}")
>>> attribute(name:"Specification-Vendor", value:"${vendor}")
>>> attribute(name:"Implementation-Title", value:"${project.name}")
>>> attribute(name:"Implementation-Version", value:"${version}")
>>> attribute(name:"Implementation-Vendor", value:"${vendor}")
>>> attribute(name:"Main-Class", value:"de.mabe.xea.ui.XeaUI")
>>> }
>>> }
>>> }
>>>
>>>
>>> Produces the following error:
>>> * What went wrong:
>>> Execution failed for task ':myjar'.
>>> Cause: jar doesn't support the nested "attribute" element.
>>>
>>
>>
>> manifest implements an attributes method (note the plural) that takes a
>> map.
>> Like:
>> ant.jar(destfile:destFile) {
>> manifest() {
>> attributes (
>> 'Specification-Title': project.name",
>> 'Specification-Version':version
>> )
>> }
>> }
>>
>
> Hmm, this will result in this error:
> No 'manifest' attribute was specified for the <jar> task, a default manifest
> will be generated.
> Seems logical to me because there is no <attribute> ant tag which takes a
> Map as argument.
>
> The problem now is that I can't do it either way using Groovy's Ant.
>
>
I'm sorry, I responded too quickly. It is gradle's native jar task that takes
an attributes method with a map. I didn't notice you were using ant's jar -
even when I reproduced part of your snippet. Out of curiosity, why are you
using ant's jar?
--
Steve Appling
Automated Logic Research Team
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email