But I guess that what is really meant is ‘by module name’, too bad :).
But basically that’s what I’m trying to do, something like that (I’m making this up) :
exclude module: 'foo', artifactName: 'bar'
Meaning, I will get all artifacts of module foo, expect artifact ‘bar’ ( bar.ear, for exemple)
Using ‘configuration’ in the dependency is not an option because the publication of this module does not allow me to filter by configuration
I could explicitly declare the transitive dependency and use the ‘artifact only’ notation in order to filter the artifacts of the dependency, but in this case I will have to explicitly declare the version number of the transitive dependency (and I don’t really want to maintain the version in the gradle.build file in sync with the version declared in the other modules)
I don’t think this is supported directly, but you should be able to implement it yourself based on ‘Configuration.resolvedConfiguration.resolvedArtifacts’. Have a look at the Javadoc for ‘Configuration’, ‘ResolvedConfiguration’, and ‘ResolvedArtifact’.
General dependency management features (like excluding modules) are described in the Gradle user guide.
Would you do it like that ? (here for exemple I want to keep only the jar in my classpath, as some dependencies would pollute it with other type of artifacts)
But it does not work (the eclipse classpath still contains the artifacts).
I’ve done more tests, and I may be mistaken, but it really looks like http://issues.gradle.org/browse/GRADLE-1487 only for files in the cache, something like : “eclipse plugin does not honor minusConfigurations for file dependencies when the files are in the cache”
Thanks Peter for pointing it out. The Gradle message was a bit cryptic for me
How can I exclude sourceSets.main.output from Eclipse classpath in this case? It includes a non existing directory (resources) and Eclipse complains about it.
Will it be a better approach to create the missing directory instead (sourceSets.main.output.each { it.mkdirs() }) ?