如何指定“pig-0.13.0-h2.jar"build.gradle 中的依赖? [英] How to specify "pig-0.13.0-h2.jar" dependency in build.gradle?
问题描述
为了在我的项目中指定一个 Maven 依赖项,我提供了一个 name、一个 group id 和一个 version.这对于我项目中的每个依赖项来说已经足够了,保存一个.Pig 在同一个工件中有多个 jar(不确定我是否有正确的命名法;我对 Maven 还是比较陌生),但我只需要一个.
To specify a Maven dependency in my project, I provide a name, a group id, and a version. This has been enough for every dependency in my project, save one. Pig has multiple jars in the same artifact (not sure if I have the proper nomenclature; I'm still rather new to Maven), but I only need one.
具体来说,我需要pig-0.13.0-h2.jar
.但是,当我提供依赖项
Specifically, I need pig-0.13.0-h2.jar
. However, when I provide the dependency
compile "org.apache.pig:pig:0.13.0"
在我的 build.gradle
中,只有 pig-0.13.0.jar
、pig-0.13.0-sources.jar
和pig-0.13.0.pom
已下载.我需要*-h2.jar",因为这是与我的 Hadoop 版本一起使用的正确方法.
in my build.gradle
, only pig-0.13.0.jar
, pig-0.13.0-sources.jar
, and pig-0.13.0.pom
are downloaded. I need the "*-h2.jar", because that's the correct one to work with my version of Hadoop.
有没有办法告诉 Gradle(通常还有 Maven 或其他任何东西)我的编译依赖项需要这个确切的 jar,并且只有这个应该包含在类路径中?
Is there a way to tell Gradle (and, generally, Maven or whatever) that my compile dependency requires this exact jar, and that only this one should be included in the classpath?
推荐答案
你需要的是指定分类器.以下脚本将完成这项工作:
What you need is to specify the classifier. The following script will do the job:
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile "org.apache.pig:pig:0.13.0:h2"
}
task copyDeps(type: Copy) {
from configurations.compile
into 'deps'
}
这篇关于如何指定“pig-0.13.0-h2.jar"build.gradle 中的依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!