Fix for attaching dependency sources

This pull request contains a test and a pretty rough fix for the issue described here:

http://forums.gradle.org/gradle/topics/idea_gradle_plugin_generates_wrong_sources_jar_for_multi_artifact_dependencies