I’m migrating a large enterprise build (ant + ivy) to gradle.
I have some issues on the compile and testCompile classpath where it has duplicated jars (jar + source jar), looking at the existing ant script they were using something like this to “filter” the dependencies on the classpath .
definitely works.
Note that multiple ivy conf is not supported at the moment.
As suggested here, I emitted the possibility of having this included in the short notation, as many ivy.xml of large entreprise artifacts are using the conf attribute to do the sort of things you do as well (sources jar, tests jar, dependOnDependencyFooVersionBar, dependOnDependencyFooVersionBaz, etc etc)
But the problem is that gradle is also including the source jar in the classpath, if I do println compile.asPath it will display the DepdencyName jar twice (because the source jar and the jar itself have the same name).
How can I exclude the source jar from the compile classpath ? The only way to identify the source jar is through the type attribute. As you can see:
Hi Carlos, sorry about the confusion.
I should have read your question more deeply.
I’m using the artifact {} block myself at work.
compile("group:module:version") {
artifact {
name = "artiName"
type = "jar"
}
}
runtime("group:module:version") {
artifact {
name = "artiName2"
type = "jar"
}
}
It’s working in my case, but probably because the artifacts’ names are not the same. To be confirmed by a gradle dev, but maybe the type attribute of DependencyArtifact is not well checked.
When you speak about putting the sources in the classpath, you speak about the Gradle Eclipse plugin that do not fill the .classpath file correctly ?
No, I’m not using the Gradle Eclipe plugin, I’m only using the java plugin.
In the compile and compileTest tasks, the classpath is wrong leading to some compile errors/test failures. That’s why in the current ant script they do this: