[GRADLE-2894] 'resource' method on WtpComponent overwrites default wb-resource instead of adding Created: 22/Sep/13  Updated: 10/Mar/15  Resolved: 10/Mar/15

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.4-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 1


 Description   

Tested on Gradle 1.5 and Gradle 1.7

Consider this code block in a script:

eclipse {
wtp {
component {
resource deployPath: '/foobar', sourcePath: 'profiles/development/src/main/webapp'
println resources
}
}
}

According to documentation, a wb-resource element with sourcePath 'profiles/development/src/main/webapp' and deployPath 'foobar' should be added to the org.eclipse.wst.common.component.

Instead the result is this:

...
...
<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/>
<wb-resource deploy-path="/foobar" source-path="profiles/development/src/main/webapp"/>
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/tavant-common/tavant-common">
<dependency-type>uses</dependency-type>
</dependent-module>
...
...

To get the documentation behavior one has to restate the default:

eclipse {
wtp {
component {
resource deployPath: '/foobar', sourcePath: 'profiles/development/src/main/webapp'
resource deployPath: '/', sourcePath: project.webAppDirName
}
}
}

Either this is a bug, or the documentation is wrong.

Note that this project is a child project in a multiproject build.



 Comments   
Comment by Gradle Forums [ 22/Sep/13 ]

I think what the documentation tries to convey is that multiple calls to `resource` are additive, not that the defaults are kept.

Comment by Gradle Forums [ 22/Sep/13 ]

Please update the documentation since it was not clear at all to me (and I guess a lot of other users too).

Generated at Wed Jun 30 12:34:19 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.