简体   繁体   English

Gradle依赖项本地jar文件

[英]Gradle dependencies local jar file

I have problem with include local jar file. 我在包含本地jar文件时遇到问题。

I have two projects: 我有两个项目:

ProjectA

ProjectB

  --libs

   ----jgrapht-jdk1.6.jar

My build file include (This is the part that concerns projectB): 我的构建文件包括(这是与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'       
}}

I run command gradlew -q dependencies and see result 我运行命令gradlew -q依赖项并查看结果


Project :ProjectB 项目:ProjectB

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.

I use gradle 1.8, Windows 7 x64 Tell me please where I made a mistake. 我使用gradle 1.8,Windows 7 x64,请告诉我哪里出错了。

It's a known limitation that file dependencies aren't currently shown by gradle dependencies . 已知的限制是gradle dependencies当前未显示文件依赖gradle dependencies They nevertheless work (if the paths are right). 尽管如此,它们仍然可以工作(如果路径正确)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM