[GRADLE-369] Improve chapter on dependency management Created: 26/Jan/09  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Jon Cox Assignee: Unassigned
Resolution: Won't Fix Votes: 0


 Description   

Section 14.2.3 of the User manual references a function named: addClientModule

Maybe there was such a function once, but it looks like it must have
changed to 'clientModule' (i.e.: without the 'add' prefix).

Also, it would have been nice to show the call to 'clientModule'
within the scope of a dependencies

{ .... }

closure.

Digging through the examples that come with gradle I found two buld
scripts that made this bit of functionality a lot easier to understand.

The first was:

src/samples/javaproject/api/build.gradle
dependsOn(':shared')
dependencies {
    compile project(':shared')
    clientModule(['compile'], "commons-lang:commons-lang:2.4") {
        dependency("commons-io:commons-io:1.2")
    }
    addConfiguration('spi')
}

libs.jar(appendix: 'spi', confs: ['spi']) {
    fileSet() {
        include('org/gradle/api/')
    }
}

The other one was:

src/samples/groovyproject/testproject/build.gradle
  ...
 dependencies {
    clientModule(['groovy'], "org.codehaus.groovy:groovy-all:1.6-beta-1") {
        dependency("commons-cli:commons-cli:1.0")
    }
    compile project(':groovycDetector')
    testCompile "junit:junit:4.4"
}   

It would have also been helpful had the user manual pointed out that
the overloaded clientModule methods are defined by
org.gradle.api.dependencies.DependencyContainer

Had the signatures of these overloaded methods also been presented
in the user manual right then & there, it would have been nice too.

Finally, not all users who are new to Gradle have ever used Ivy or Maven before,
so the entire concept of the remote repository can't be taken for granted.
I think there should be something in the docs to point out that they're called
"client" modules because the recursive configuration information is presented
directly in the repository's client (i.e.: in the gradle script), rather than in the
server (the repository itself).

What made it all click was seeing an example of an "ivy xml file" in the context of a repository.
Suppose we had a module id of the form:

      [organisation]/[module]/[type]s/[artifact]-[revision].[ext]

For example. let's say you referred to a module dependency
using the module id name: "apache:xerces:xmlParserApis:2.0.2"

If Gradle didn't have the clientModule feature, you'd need to have
an ivy xml file name something like "ivy-2.0.2.xml" with the same
basic information to express the recursive dependency information
within the context of an Ivy repository directory structure that could
look something like this:

  /foobar/ivy-local-repository/apache/xerces/ivys/ivy-2.0.2.xml
  /foobar/ivy-local-repository/apache/xerces/ivys/ivy-2.4.0.xml
  /foobar/ivy-local-repository/apache/xerces/jars/xerces-2.0.2.jar
  /foobar/ivy-local-repository/apache/xerces/jars/xerces-2.4.0.jar
  /foobar/ivy-local-repository/apache/xerces/jars/xmlParserAPIs-2.0.2.jar

Where

  • myrepository = /foobar-repository/ivy-local-repository
  • organization = apache
  • module = xerces
  • type = jars
    • artifact = xerces-2.0.2.jar
    • artifact = xerces-2.4.0.jar
    • artifact = xmlParserAPIs-2.0.2.jar
  • type = ivys
    • artifact = ivy-2.0.2.xml
    • artifact = ivy-2.4.0.xml

Ok, there comes a point where you definitely want to steer someone
to the Ivy website. Some other links to reference here for more info:
http://www.jaya.free.fr/ivy/doc/tutorial/defaultconf.html and
http://www.jaya.free.fr/ivy/doc/tutorial/build-repository/basic.html

I hope this helps.



 Comments   
Comment by Hans Dockter [ 18/May/09 ]

Hi Jon,

the bug is fixed. Implementation of the other reccomendations is postponed to 0.7.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 11:28:24 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.