我有包含本地 jar 文件的问题。
我有两个项目:
ProjectA
ProjectB
--libs
----jgrapht-jdk1.6.jar
我的构建文件包括(这是与projectB有关的部分):
project(':ProjectB') {
apply plugin: 'java'
repositories {
mavenCentral()
}
configurations {
compileOnly
}
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
dependencies {
compileOnly files('libs/jgrapht-jdk1.6.jar')
compile 'org.simpleframework:simple-xml:2.7@jar'
}}
我运行命令 gradlew -q dependencies 并查看结果
项目:项目B
archives - Configuration for archive artifacts.
No dependencies
compile - Compile classpath for source set 'main'.
\--- org.simpleframework:simple-xml:2.7
compileOnly
No dependencies
default - Configuration for default artifacts.
\--- org.simpleframework:simple-xml:2.7
runtime - Runtime classpath for source set 'main'.
\--- org.simpleframework:simple-xml:2.7
testCompile - Compile classpath for source set 'test'.
\--- org.simpleframework:simple-xml:2.7
testRuntime - Runtime classpath for source set 'test'.
\--- org.simpleframework:simple-xml:2.7
Line compile 'org.simpleframework:simple-xml:2.7@jar' - working fine,
but line compileOnly files('libs/jgrapht-jdk1.6.jar') don't work.
我使用 gradle 1.8,Windows 7 x64 请告诉我哪里出错了。