In ivy, this style configuration is very common and almost used everywhere.
For example, the ivy.xml for easymock 3.0 <dependencies> <dependency org="cglib" name="cglib-nodep" rev="2.2" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> <dependency org="org.objenesis" name="objenesis" rev="1.2" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> <dependency org="junit" name="junit" rev="4.8.1" force="true" conf="test->runtime(*),master(*)"/> </dependencies> And also testng 6.1 <dependencies> <dependency org="ant" name="ant" rev="1.6.5" force="true" conf="optional->compile(*),master(*)"/> <dependency org="junit" name="junit" rev="3.8.1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> <dependency org="org.beanshell" name="bsh" rev="2.0b4" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> <dependency org="com.google.inject" name="guice" rev="2.0" force="true" conf="provided->compile(*),provided(*),runtime(*),master(*)"/> <dependency org="com.beust" name="jcommander" rev="1.12" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> <dependency org="org.yaml" name="snakeyaml" rev="1.6" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> </dependencies> Without this feature, how can we do this in gradle for similar case? *conf="compile->compile(*),master(*);runtime->runtime(*)"/>* This configuration is widely used in ivy world. So I think this is a very important feature, even a core feature for ivy's dependency management: this is why I like ivy more than maven in dependency management. I will rise a jira issue for this. Sky Ao On Wed, Jun 1, 2011 at 4:34 PM, Szczepan Faber <[email protected]> wrote: > Hey > > > So, My suggestion is that we need to support it in gradle, > > Could be. Can you file a jira ticket for it (unless there's already one)? > > > since gradle uses ivy as dependency manager and ivy supports this > feature. > > We use ivy behind the hood yet bear in mind it does not mean we want > to port all ivy features 1:1 into our dsl :) > > Cheers! > Szczepan > > On Mon, May 30, 2011 at 6:04 AM, Sky Ao <[email protected]> wrote: > > HI, all > > I used ivy for years and aways used the ivy configuration for some > > common case like depend on two or more configurations of the dependency. > > In ivy, the configuration will be like this : 'runtime -> compile(*), > > runtime(*)'. It says that the configuration 'runtime' of this project > will > > depends on the "compile" and 'runtime' configurations of the dependency. > > And compile(*) is to say that if no compile configuration found in the > > dependency, "*" will be used to avoid failure. > > In gradle, when I want to use similar format in configuration, the > > gradle will reports error and don't support configuration like : > > 'compile(*)', 'compile, runtime'. > > Even for '*', standard ivy format for all configurations, the gradle > > doesn'tsupport : gradle will not report error, but nothing of this > > dependency will be effective. > > To confirm this case, I checked the source code of gradle. In > > class DefaultIvyDependencyResolver, I found the reason: > > private ResolveOptions createResolveOptions(Configuration > > configuration) { > > ResolveOptions resolveOptions = new ResolveOptions(); > > resolveOptions.setDownload(false); > > > resolveOptions.setConfs(WrapUtil.toArray(configuration.getName())); > > return resolveOptions; > > } > > In this method, the configuration name will be directly passed to > > ivy resolveOptions by a simply wrap from a String to a String[]. So when > the > > configuration is 'compile,runtime', I expect that the ivy will handle two > > configurations like String[]{"compile", "runtime"} , but gradle will pass > a > > String["compile,runtime"] to ivy. > > This is not the way that Ivy works for the configuration of > > denpendency. The support for complex ivy configuration is very powerful > > and convenient. Now in gradle, I have to write two lines to set > > one dependency with two configuration like this: > > felixProvidedBundle group:'org.apache.felix', > > name:'org.apache.felix.webconsole', version:'3.1.8', > configuration:'master' > > felixProvidedBundle group:'org.apache.felix', > > name:'org.apache.felix.webconsole', version:'3.1.8', > > configuration:'provided' > > And I have no way to support this format "compile(*)". > > Here is a real ivy dependencies setting for > > 'org.apache.felix.webconsole', we can see that the conf properties are > aways > > complex. > > <dependencies> > > <dependency org="javax.servlet" name="servlet-api" rev="2.4" force="true" > > conf="provided->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="commons-fileupload" name="commons-fileupload" > rev="1.1.1" > > force="true" > conf="optional->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="commons-io" name="commons-io" rev="1.4" force="true" > > conf="optional->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="org.osgi" name="org.osgi.core" rev="4.1.0" force="true" > > conf="provided->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="org.osgi" name="org.osgi.compendium" rev="4.1.0" > > force="true" > conf="provided->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="org.json" name="json" rev="20070829" force="true" > > conf="optional->compile(*),master(*)"/> > > <dependency org="org.apache.felix" name="org.apache.felix.scr" > rev="1.6.0" > > force="true" > conf="provided->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="org.apache.felix" name="org.apache.felix.shell" > rev="1.0.0" > > force="true" > conf="provided->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="org.apache.felix" name="org.apache.felix.framework" > > rev="2.0.2" force="true" > > conf="optional->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="org.apache.felix" name="org.apache.felix.utils" > rev="1.0.0" > > force="true" > conf="optional->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="org.apache.felix" name="org.osgi.service.obr" > rev="1.0.2" > > force="true" > conf="provided->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="org.apache.felix" > name="org.apache.felix.bundlerepository" > > rev="1.6.0" force="true" > > conf="optional->compile(*),provided(*),runtime(*),master(*)"/> > > <dependency org="junit" name="junit" rev="4.0" force="true" > > conf="test->runtime(*),master(*)"/> > > <dependency org="org.easymock" name="easymock" rev="2.4" force="true" > > conf="test->runtime(*),master(*)"/> > > <dependency org="org.mockito" name="mockito-all" rev="1.7" force="true" > > conf="test->runtime(*),master(*)"/> > > </dependencies> > > So, My suggestion is that we need to support it in gradle, since > > gradle uses ivy as dependency manager and ivy supports this feature. > > > > Sky Ao > > > > > > -- > Szczepan Faber > Principal engineer@gradleware > Lead@mockito > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > >
