[GRADLE-2077] processResources.source property return wrong data Created: 02/Feb/12  Updated: 04/Jan/13  Resolved: 13/May/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-7
Fix Version/s: None

Type: Bug
Reporter: Sviatoslav Romanenko Assignee: Unassigned
Resolution: Not A Bug Votes: 0


 Description   

I'm not sures is it bug or not

Why processResources.source returns string 'main resources' and not path to E:\projects\mytest\src\main\resources

'build.grdale'
apply plugin: 'war'
task viewPath << {
    println processResources.source
    println processResources.destinationDir
}
'output'
Executing command: ":viewPath"
:viewPath
main resources
E:\projects\mytest\build\resources\main

BUILD SUCCESSFUL

Total time: 2.247 secs

Completed Successfully


 Comments   
Comment by Adam Murdoch [ 02/Feb/12 ]

The processResources.source property is of type FileCollection (have a look at http://gradle.org/docs/current/dsl/org.gradle.api.tasks.Copy.html). So, the statement println processResources.source is going to be printing out it's toString() value, which is 'main resources'. Instead, you can do something like this:

processResources.source.each

{ println it }

This will print out the source files, not the source directory.

You might be better off using sourceSets.main.resources.srcDirs and sourceSets.main.output.resourcesDir (have a look at http://gradle.org/docs/current/dsl/org.gradle.api.tasks.SourceSet.html)

Comment by Sviatoslav Romanenko [ 12/May/12 ]

Thank you very much.

suppose issue could be closed now.

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