How to specify a classifier in a gradle dependency's dependency?

JavaDependency InjectionGuiceGradleDependency Management

Java Problem Overview


Say I want to add guice-assistedinject as a dependency in my project. It specifies the guice artifact as a dependency itself. How do I tell it to use the no_aop version of guice?

I know I can do the following, but can I do it in one step without excluding the guice module?

dependencies {
  compile (group: 'com.google.inject.extensions', name: 'guice-assistedinject', version: '3.0') {
    exclude module: 'guice'
  }
  compile group: 'com.google.inject', name: 'guice', version: '3.0', classifier: 'no_aop'
}

Java Solutions


Solution 1 - Java

There is no simpler solution. You can shorten the code by using short dependency notation (e.g. "com.google.inject:guice:3.0:no_aop").

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjgrowlView Question on Stackoverflow
Solution 1 - JavaPeter NiederwieserView Answer on Stackoverflow