My environment uses Ivy repositories where source attachments are declared as Ivy type “src” (as opposed to “jar” for binaries), and the corresponding file is named “nnnn.src.jar”, which doesn’t match the standard Maven nnn-sources.jar.
Not only do I not get source attachments for dependencies with source archives, but the bigger problem is that Gradle includes artifacts other than binaries (Ivy type “jar”) on the classpath. I have resported this as bug GRADLE-2733.
In the meantime, how can I work around this in my build script to filter out artifacts with these file names?
Does your Ivy module not have a configuration that only exposes the artifacts you want?
If not, you might be able to use client modules to work around this. I’ve not tried for this kind of problem.
No, our extensive legacy Ivy repositories expose the sources attachment in the same configuration as the binary “jar”, but separate by “type”. I think this is “correct” and should work; only type “jar” artifacts should appear on the classpath.
There is the “@jar” artifact filter, but to my understanding it works on “extension” rather than “type”, and a source attachment such as xyz-sources.jar still has extension “jar”.
The @X syntax specifies both extension and type.
I can’t see a way to do this other than client modules.