在我的插件中,我使用了几个外部依赖项
compile "org.apache.httpcomponents:httpclient:$httpClientVersion"
compile "commons-io:commons-io:$commonsIoVersion"
// tar & xz support
compile "org.tukaani:xz:$xzLibraryVersion"
compile "org.apache.commons:commons-compress:$commonsCompressVersion"
// logging
compile "io.github.microutils:kotlin-logging:$kotlinLogginVersion"
compile "org.slf4j:slf4j-simple:$slf4jSimpleVersion"
当我使用我的插件时,我必须将它们作为classpath
依赖项提供
classpath "org.tukaani:xz:$xzLibraryVersion"
classpath "commons-io:commons-io:$commonsIoVersion"
classpath "org.apache.commons:commons-compress:$commonsCompressVersion"
classpath "com.lapots.gradle.plugins.appenv:gradle-app-environment-plugin:0.1"
classpath "io.github.microutils:kotlin-logging:$kotlinLogginVersion"
有没有办法摆脱它?我的意思是允许只设置我的插件依赖项和它提供的其他依赖项吗?
答案 0 :(得分:0)
ext.commonDeps = [
"org.tukaani:xz:$xzLibraryVersion",
"commons-io:commons-io:$commonsIoVersion",
"org.apache.commons:commons-compress:$commonsCompressVersion",
"com.lapots.gradle.plugins.appenv:gradle-app-environment-plugin:0.1",
"io.github.microutils:kotlin-logging:$kotlinLogginVersion"
]
buildscript.dependencies {
classpath commonDeps
}
dependencies {
compile commonDeps
}