小编bhu*_*rey的帖子

Gradle排除依赖项中的特定文件

我想知道是否有任何方法要排除特定文件,这些文件位于依赖项(不是传递依赖项)中,不会被下载.

我正在将一个构建从Ant + Ivy切换到Gradle,这是在Ivy之前完成的.我问,因为我有一个依赖包含Artifactory中的许多已编译的wsdl jar我们正在拉下来,但我不想下载依赖项中的所有jar.

在常春藤,它设置如下:

这6个工件发布到Artifactory到一个目录repo/dep.location/example/7.3/jar.

<publications>
    <artifact name="foo-1-0" type="jar" />
    <artifact name="foo-1-0-async" type="jar" />
    <artifact name="foo-1-0-xml" type="jar" />
    <artifact name="bar-1-0" type="jar" />
    <artifact name="bar-1-0-async" type="jar" />
    <artifact name="bar-1-0-xml" type="jar" />
</publications>
Run Code Online (Sandbox Code Playgroud)

这就是我只检索六个工件中的两个.

<dependency org="dep.location" name="example" rev="7.3"
            conf="compile,runtime">
    <include name="foo-1-0-async"/>
    <include name="foo-1-0-xml"/>
</dependency>
Run Code Online (Sandbox Code Playgroud)

目前,如果我尝试在Gradle中执行类似的操作,则会忽略排除,并下载所有六个工件.

compile (group:"dep.location", name:"example", version:"7.3")
{
    exclude module:'foo-1-0-xml'
    exclude module:'bar-1-0'
    exclude module:'bar-1-0-async'
    exclude module:'bar-1-0-xml'
}
Run Code Online (Sandbox Code Playgroud)

我正在使用Gradle 1.8版.

java dependencies artifactory gradle

44
推荐指数
1
解决办法
2万
查看次数

标签 统计

artifactory ×1

dependencies ×1

gradle ×1

java ×1