Thanks for reply, Adam. You're right it was a syntax issue.

Unfortunately now I'm getting a different error:

Cause: The dependency notation: project ':web-lib' is invalid!

I've tried both beforeEvaluation and afterEvaluation

Thanks for the help.


On Wed, Sep 23, 2009 at 5:02 PM, Adam Murdoch <[email protected]> wrote:
>
>
> Andrei Sereda wrote:
>
> Hi everybody,
>
> I have a question regarding runtime configuration of project
> dependencies. My goal is to dynamically configure project dependencies
>  (compile, runtime, test etc.) based on it's name (then possibly to
> override it on individual basis).
>
> My script looks like this:
>
> allprojects {
>
>    beforeEvaluate { project ->
>         if ( project.name.endsWith("-web") )
>            project.dependencies.add("compile", project(':web-lib'))
>     }
>
> }
>
> However I get this error :
>
> Cause: Could not find method call() for arguments [:web-lib] on
> project ':project1-web'
>
> Is there any other way I could achieve this ?
>
>
>
> You're pretty close. Groovy thinks that project(':web-lib') is a closure
> call on the 'project' parameter of the beforeEvaluate closure, but 'project'
> isn't a closure, so you get this error message. You could rename the
> parameter to something other than 'project':
>
>  beforeEvaluate { p ->
>         if ( p.name.endsWith("-web") )
>            p.dependencies.add("compile", project(':web-lib'))
>     }
>
> Or you could qualify the call to the project() method
>
>  beforeEvaluate { project ->
>         if ( project.name.endsWith("-web") )
>            project.dependencies.add("compile", this.project(':web-lib'))
>     }
>
> Adam
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to