【发布时间】:2014-02-25 17:09:29
【问题描述】:
在我的build.gradle 文件中,我有以下内容:
...
dependencies {
...
testCompile (group: 'org.uncommons', name: 'reportng', version: '1.1.2') { exclude group: 'org.testng', module: 'testng' }
...
}
...
reportng 需要velocity-1.4.jar 和velocity-dep-1.4.jar,实际上上面的testCompile 依赖导致这两个JAR 被提取并放入Eclipse 的.classpath 文件中,作为“导出”(即,他们在 Eclipse 的“Java Build Path”对话框的“Order and Export”选项卡中的复选框被选中)。
这 2 个 JAR 被设置为导出的事实是一个问题。我需要它们仍然被提取但不被导出。
从Gradle doc 我了解到这是通过使用noExportConfigurations 按照他们的示例完成的:
apply plugin: 'java'
apply plugin: 'eclipse'
configurations {
provided
someBoringConfig
}
eclipse {
classpath {
//if you don't want some classpath entries 'exported' in Eclipse
noExportConfigurations += configurations.provided
}
}
我的问题是我没有configurations {} 部分,虽然我当然可以添加一个,但我不知道要在其中放入什么以便从导出中排除而不是整个 reportng 而只是它附带的两个 JAR。
【问题讨论】:
标签: eclipse gradle build gradle-eclipse