Idea gradle plugin generates wrong sources jar for multi artifact dependencies

I have a project that depends on a library in Ivy eg myorg:mylib:1.0 - this library has several artifacts:

mylib-1.0.jar mylib-api-1.0.jar mylib-core-1.0.jar

Each of these have a sources jar:

mylib-sources-1.0.jar mylib-ap-sourcesi-1.0.jar mylib-core-sources-1.0.jar

But when I generate Intellij project using gradle idea task I get the same source attachment for all these jars.

The same problem affects Intellij IDEA Gradle integration, since it uses the same dependency resolution mechanism thru tooling api See original user request at http://youtrack.jetbrains.com/issue/IDEA-128460

The project attachment on the original issue http://youtrack.jetbrains.com/issue/IDEA-128460 demonstrates the problem.

Thanks for the report. I’ve created GRADLE-3170 to track this. There were a couple of related issues in Jira already.