Steve Appling wrote:
I haven't tried this, but I don't think that you are accessing the
project you think you are inside of the doFirst closure. That closure
is not executed during the configuration phase when the project
property is set, so it will always have the value of the last subproject.
Try using the current task to get the project like :
project.processResources.doFirst { task->
println "I'm $task.project.name"
println "type: $task.project.artifactType"
println task.project.resourceDirs
task.project.resourceDirNames = new LinkedList()
task.project.resourceDirNames.add
"/main/resources/default"
println task.project.resourceDirs
}
Or even:
subprojects {
...
resourceDirNames = ['/main/resources/default']
}
Narco wrote:
Hello!
I`m still not getting how gradle works. What I need is to control
behaviour
of modules in my multi project build from root project. For start I
need to
override default resources folder "resourceDirNames". The problem is
that
gradle is processing my scripts in absolutely wrong module.
I have two modules - app with artifactType=jar and web-main with
artifactType=war. My build.gradle script:
subprojects {
usePlugin('java')
...
if (project.artifactType.equals('jar') ||
project.artifactType.equals('ejb')) {
usePlugin('java')
project.processResources.doFirst {
println "I'm $project.name"
println "type: $project.artifactType"
println project.resourceDirs
project.resourceDirNames = new LinkedList()
project.resourceDirNames.add
"/main/resources/default"
println project.resourceDirs
}
}
}
I`m using command:
gradle -C=off app:test
What I get is:
:app:compile
:app:compileTests
:app:processResources
I'm web-main
type: war
[C:\work\perf\SCM\Build\Ant\Project\Release_2_0_1\MDL\web-main\src\main\resource
s]
[C:\work\perf\SCM\Build\Ant\Project\Release_2_0_1\MDL\web-main\src\main\resource
s\default]
:app:processTestResources
:app:test
BUILD SUCCESSFUL
Total time: 8.36 secs
As I see the app project is building but its using properties from
web-main,
which should be ignored in this case at all. In app/build/classes
there are
wrong resources too of course.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email