我使用此代码获取所需的库,并在编译期间复制它们:
task copyToLib( type: Copy ) {
into "$buildDir/libs/lib"
from configurations.runtime
}
jar {
dependsOn copyToLib
...
}
当我使用lagecy-Gradle模型添加依赖项时,使用
compile
:
dependencies {
compile 'net.objecthunter:exp4j:0.4.8'
compile 'io.undertow:undertow-core:2.0.16.Final'
compile 'org.postgresql:postgresql:42.2.5'
...
}
但是当我使用
api
关键词:
dependencies {
api 'net.objecthunter:exp4j:0.4.8'
api 'io.undertow:undertow-core:2.0.16.Final'
api 'org.postgresql:postgresql:42.2.5'
...
}
configurations.runtime