[GRADLE-391] User Guide Manifest Examples Invalid in section 10.8.4 Created: 10/Feb/09  Updated: 04/Jan/13  Resolved: 31/Mar/09

Status: Resolved
Project: Gradle
Affects Version/s: 0.5.2
Fix Version/s: 0.6

Type: Bug
Reporter: Spencer Allain Assignee: Adam Murdoch
Resolution: Fixed Votes: 0


10.8.4 Manifest

Both examples in this section have the below incorrect line:

manifest.mainAttributes(Implementation-Title: "Gradle", Implementation-Version: $version)

This is invalid Groovy code because of the '-' in both Implementation-Title and Implementation-Version

When attempting to build, the following error occurs because it's trying to treat Implementation-Title as an expression, instead of as a String.

build_gradle: 11: illegal colon after argument expression;
solution: a complex label expression before a colon must be parenthesized @ line 11, column 34.

The below is all that's needed to correct the example, and is arguably a good practice because you are forcing it to treat the key as a string value.

manifest.mainAttributes("Implementation-Title": "Gradle", "Implementation-Version": $version)

Comment by Spencer Allain [ 10/Feb/09 ]

Hmm, looks like I forgot about the other fix I had to make, (which I had corrected in my own usage). The use of $version results in:

build_gradle: 11: unexpected token: $ @ line 11, column 49.

The version(s) that actually work would be:

manifest.mainAttributes("Implementation-Title": "Gradle", "Implementation-Version": "$version")
manifest.mainAttributes("Implementation-Title": "Gradle", "Implementation-Version": version)

Generated at Wed Jun 30 11:28:55 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.