如何在gradle依赖项的依赖项中指定分类器? [英] How to specify a classifier in a gradle dependency's dependency?

查看:169
本文介绍了如何在gradle依赖项的依赖项中指定分类器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想在我的项目中添加guice-assistedinject作为依赖项。它将guice工件指定为依赖关系本身。我如何告诉它使用guice的no_aop版本?



我知道我可以做到以下几点,但是我可以在不排除guice模块的情况下一步完成它吗?

 依赖关系{
编译(组:'com.google.inject.extensions',名称:'guice-assistedinject ',版本:'3.0'){
排除模块:'guice'
}
编译组:'com.google.inject',名称:'guice',版本:'3.0' ,classifier:'no_aop'
}


解决方案

没有更简单的解决方案。您可以使用短依赖性表示法缩短代码(例如com.google.inject:guice:3.0:no_aop)。


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'
}

解决方案

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").

这篇关于如何在gradle依赖项的依赖项中指定分类器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆