nebula-plugins / gradle-extra-configurations-plugin

Gradle plugin introducing a provided dependency configuration and marking a dependency as optional.
Apache License 2.0
139 stars 18 forks source link

Optional plugin fails when more than one dependency has the same artifactid #32

Closed drmaas closed 7 years ago

drmaas commented 7 years ago

Example:

compile 'io.reactivex:rxjava:1.2.7', optional
compile 'io.reactivex.rxjava2:rxjava:2.0.7', optional

Command: gradle generatePomFileForMavenJavaPublication --stacktrace

Error:

Caused by: java.lang.IllegalArgumentException: argument type mismatch
        at nebula.plugin.extraconfigurations.OptionalBasePlugin$_configureMavenPublishPlugin_closure2$_closure5$_closure6$_closure7$_closure8$_closure9.doCall(OptionalBasePlugin.groovy:71)
        at nebula.plugin.extraconfigurations.OptionalBasePlugin$_configureMavenPublishPlugin_closure2$_closure5$_closure6$_closure7$_closure8.doCall(OptionalBasePlugin.groovy:64)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
        at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
        at org.gradle.util.ConfigureUtil$1.execute(ConfigureUtil.java:123)
        at org.gradle.api.internal.UserCodeAction.execute(UserCodeAction.java:38)
        ... 91 more
drmaas commented 7 years ago

https://github.com/nebula-plugins/gradle-extra-configurations-plugin/blob/master/src/main/groovy/nebula/plugin/extraconfigurations/OptionalBasePlugin.groovy#L66

should be changed to:

it.groupId.text() == dep.group && it.artifactId.text() == dep.name