On Oct 21, 2008, at 11:36 AM, mvlcek wrote:

The problem was rather in the setup of the repository :-(

classpathResolvers.add(new FileSystemResolver()) { ... artifactPatterns = [ "${ivyRepBase}/FILES/[organisation]/[module]/ [artifact]-[revision].[type]" ] } will crash during resolving before the compilation, as artifactPatterns is a set to a list of GStrings instead of Strings like here:

artifactPatterns = [ ivyRepBase + '/FILES/[organisation]/[module]/ [artifact]-[revision].[type]' ] (Any other configuration than "compile" will not throw an error, as the dependency is irrelevant for compilation!).

However, finding the error was made more difficult as necessary, as the compile task will just throw a NullPointerException, if any resolving failed, either because of a incorrectly set up repository or misspelling, e.g.

compile "org.apache:commons-loggnig:1.1"
Please, change this to display the dependency, which could not be resolved.

Will gradle be enhanced to allow a simple definition of configuration dependencies?

Yes. Definitely. Soon. Please file an issue.
My code currently is as follows:

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" ]) compile "org.apache:commons-httpclient:3.+" ...

Obviously it is not nice at all that Gradle forces you to use the code above. This is all because we don't support the changing attribute yet and we don't support specifying dependencyConfigurations ((which both is easy to implement). Then you could do:

["default", "jaxws", "spring", "http"].each { depConf ->
        dependency(['compile'], "org.apache.cxf:cxf:2.0.6") {
               changing = true
               dependencyConfiguration = depConf
        }
}

But Gradle must do better in general for ivy stuff is does not support directly. So if the missing features are not implemented you should be able to do something like:

["default", "jaxws", "spring", "http"].each { depConf ->
dependency(['compile'], "org.apache.cxf:cxf: 2.0.6").applyToDependencyDescriptor { // something }
}

The only problem with this approach is that many properties of the DefaultDependencyDescriptor are immutable. So we have to get them somehow into the constructor.

Or should the default dependent configuration rather be "compile" instead of "default"?

Default is correct.

- Hans

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to