On 26/10/2010, at 3:44 AM, Roger Studner wrote:
>
> say I have in a "api-impl" subproject's build.gradle this:
>
> dependsOn(':api-contract')
>
> dependencies {
> compile project(':api-contract')
>
> }
>
> I do not *quite* get the differences between the two declarations above.. I
> mean, it appears like it should be obvious, but the intentions/end result i'm
> not so sure about.
>
> I want my implementation to "depends on" the api obviously (very common
> pattern).
>
> So.. the 2nd part to me woudl indicate it just wants to rely on the same
> jar's etc... as what api-contract implements.
This declares that api-impl depends on the classes from api-contract.
>
> Thus.. is the "first one".. to rely on the classes from the api-contract?
dependsOn(':api-contract') declares that each task t in api-impl depends on
task t in api-contract. Which is completely wrong. It adds in artificial
dependencies that don't make sense (:api-imp:clean does not depend on
:api-contract:clean, :api-impl:jar does not depend on :api-contract:jar) and it
misses ones that are needed (:api-impl:compileJava should depend on
:api-contract:jar). I suggest you don't use it. It doesn't do what you want and
just adds noise. You don't need it if you've got the second declaration.
>
> Longer term, obviously, i'd rather have the impl have:
>
> dependencies {
> compile 'api-contract-latest.jar'
> }
>
> and this in a maven repo.. but baby steps heh
>
> (the documentation on publishing artifacts is simply.. TBD, so I'm avoiding
> that for now)
>
There's a chapter about publishing at
http://www.gradle.org/0.9-rc-1/docs/userguide/artifact_management.html
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz