我对gradle完全陌生,现在我需要将gradle脚本集成到我的Jenkins工作中。 gradle脚本:
initscript {
repositories {
flatDir {
name = 'libs dir'
dir file('/opt/gradle/libs')
}
mavenLocal()
maven {url "https://plugins.gradle.org/m2/"}
}
dependencies {
classpath "com.inventage.gradle.android:android-resolve-dependency-plugin:1.0"
}
}
allprojects {
buildscript {
repositories {
flatDir {
name = 'libs dir'
dir file('/opt/gradle/libs')
}
mavenLocal()
maven {url "https://plugins.gradle.org/m2/"}
}
dependencies {
classpath "com.inventage.gradle.android:android-resolve-dependency-plugin:1.0"
}
}
apply plugin: com.inventage.gradle.android.AndroidResolvableConfigPlugin
task copyDeps(type: Copy) {
from(configurations.iqServerScanning)
into("${buildDir}/scanning")
}
}
在詹金斯工作中的称呼方式:
stage ('my stage') {
steps {
sh "cd ${workspace}/${projectName}; gradle --init-script /nexus-iq.init.gradle copyDeps"
}
}
它应该如何工作:
但是作业运行会带来以下结果:
> Task :copyDeps NO-SOURCE
> Task :app:copyDeps NO-SOURCE
configurations.iqServerScanning
-是必须在AndroidResolvableConfigPlugin apply
方法中设置的附加属性。由于configurations.iqServerScanning
是NO-SOURCE
,因此我想apply plugin: com.inventage.gradle.android.AndroidResolvableConfigPlugin
命令无效。怎么了?