如何指定"pig-0.13.0-h2.jar"?在build.gradle中有依赖关系? [英] How to specify "pig-0.13.0-h2.jar" dependency in build.gradle?

查看:115
本文介绍了如何指定"pig-0.13.0-h2.jar"?在build.gradle中有依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在我的项目中指定Maven依赖项,我提供一个名称,一个组ID 和一个 version .对于我项目中的每个依赖,这已经足够了,保存一个. 猪在同一工件中有多个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.jarpig-0.13.0-sources.jarpig-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屋!

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