Hi Adam,
With the proposed solution, when the subproject tries to modify any
configuration I get this error:
Cause: You can't change a configuration which is not in unresolved state!
It is complaining on a "compile "foo.bar:baz:1.2" in any subproject
This alternative works, though:
afterEvaluate { project ->
project.copy {
from project.configurations.testCompile.files
from project.configurations.providedCompile.files
from project.configurations.sources.files
into project.file('src/main/genlib')
}
}
On Thu, Jan 14, 2010 at 8:48 PM, Adam Murdoch <[email protected]> wrote:
>
>
> On 14/01/10 11:05 PM, Nacho Coloma wrote:
>>
>> Hi all,
>>
>> My current setup is a plain folder structure with three projects:
>> projectA, projectB and master. My settings.gradle file contains this:
>>
>> includeFlat 'projectA', 'projectB'
>>
>> I have included in master/build.gradle the following new task:
>>
>> subprojects {
>>
>> usePlugin('java')
>>
>> task 'genlib'(description: 'Copies the 3rd party libraries to /genlib',
>> dependsOn: configurations.compile) << {
>> print "(for debug only) ==>" + configurations.compile.files
>> copy {
>> into "${projectDir}/src/main/genlib"
>> from configurations.compile.files
>> }
>> }
>>
>> }
>>
>> I have specified a different set of dependencies in projectB and projectA
>>
>> If I execute this:
>>
>> cd projectA
>> gradle -i genlib
>>
>> I get the dependencies of projectB instead of projectA!! If I remove
>> projectB from settings.gradle it works as expected. Am I missing something?
>>
>
> You're running into a bug with the subprojects() method:
> http://jira.codehaus.org/browse/GRADLE-708
>
> It has been fixed in trunk, and the fix will be included in the upcoming 0.9
> release.
>
> You could use the Copy task instead of the copy() method to work around this
> problem (it's arguably a better approach anyway). For example:
>
> subprojects {
>
> usePlugin('java')
>
> task 'genlib'(type: Copy, description: 'Copies the 3rd party libraries to
> /genlib') {
> into "${projectDir}/src/main/genlib"
> from configurations.compile
> }
>
> }
>
>
> --
> Adam Murdoch
> Gradle Developer
> http://www.gradle.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email