[GRADLE-266] Support the full functionality of Ivy dependencies Created: 21/Oct/08  Updated: 04/Jan/13  Resolved: 29/Oct/08

Status: Resolved
Project: Gradle
Affects Version/s: 0.4
Fix Version/s: 0.5

Type: Improvement
Reporter: Martin Vlcek Assignee: Hans Dockter
Resolution: Fixed Votes: 1

Issue Links:
dependent
dependent on GRADLE-267 Provide consistent mechanism for buil... Resolved

 Description   

If you want to specify a dependency to a specific configuration of a module or to set the changing-flag, you currently have to do something like that:

DefaultDependencyDescriptor dd(String conf, String descr, List depConf = [ "default" ], boolean changing = false) {
String[] parts = descr.split(":");
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
new ModuleRevisionId(new ModuleId(parts[0], parts[1]), parts[2]), false, changing)
depConf.each

{ dd.addDependencyConfiguration(conf, it) }

return dd
}

dependencies

{ dependencyDescriptors.add dd("compile", "org.apache.cxf:cxf:2.0.6", [ "default", "jaxws", "spring", "http" ]) }

It would be nice to have an easy syntax like

compile org.apache.cxf:cxf:2.0.6", [ configurations: "default,jaxws,spring,http", changing:true ]

This would be compatible with the current syntax and can be easily extended later on.
Currently I would see the following additional properties:

  • configurations (short: conf): the configurations of the module which should be used, comma-separated items in a string, if not given: "default"
  • changing: false/true, default false
  • force: false/true, default false
  • branch (? I've never used it - maybe it should be included in the dependency string?), default none/null

the property transitive should not be available, because transitivity should be handled like now (compile: no, runtime: yes).



 Comments   
Comment by Adam Murdoch [ 22/Oct/08 ]

Splitting this up into a couple of issues

Comment by Hans Dockter [ 25/Oct/08 ]
  • force is already supported.
  • I think we should support 'transitive' for a dependency. A use case for this might be that a user does not want to have the transitive dependencies of a particular dependency in runtime. Please note that Gradle does already support the following notation: "org.apache.cxf:cxf:2.0.6@jar". That way only the specified artifact is used, no transitive dependencies. But there is a subtle difference compared to using the transitive property for a module, as a module can have more than one artifact.
  • I'm not sure about branch. I have never used it. I guess for now this is a candidate for: http://jira.codehaus.org/browse/GRADLE-267
  • For 0.5 the notation would look like:
dependency('compile', "org.apache.cxf:cxf:2.0.6") {
   force = true
   changing = true
   configurations = ['a', 'b']
}

We might offer eventually the following notation

compile "org.apache.cxf:cxf:2.0.6") {
   force = true
   changing = true
   configurations = ['a', 'b']
}
Generated at Wed Jun 30 11:25:48 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.