Gradle API Dependency Handler

Hi all,

i just played around with the Dependency Handler and want to add some Project Dependencies to the Compile Configuration in custom plugin. And now i have question to the syntax in Groovy:

For Normal Dependencies i use:
project.dependencies.add 'compile', "$group:$DependencyName:+"

And For Project Dependencies i use:
project.dependencies.add 'compile', project(':$bundlename')

Is the syntax correct for the project dependencies? I find the documentation very confusing, just tells you

dependencyNotation - The dependency notation, in one of the notations described above.

Would be nice if somebody can clarify the use between buildscript and a plugin use, even if there is no difference.

Thanks…

In a binary plugin the latter would actually be something like:

project.dependencies.add 'compile', project.dependencies.project(":$bundlename")

When you are talking about a build script, you’d do the following:

dependencies {
    compile project(':foo')
}

In the example above, the call to project() is actually calling DependencyHandler.project() since the dependencies { } block delegates to an instance of DependencyHandler. When simply calling add() no such delegation is happening so you have to qualify method calls.