0
我创建了自定义任务,发布在常青藤资源库中,现在我想使用它。这就是我要做的事:使用自定义gradle任务
configurations {
customTask {
transitive = false
}
}
repositories {
mavenCentral()
ivy {
url 'http://my.ivy.rep/ivyrep/shared'
layout "pattern", {
artifact "[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
}
}
}
dependencies {
customTask 'org.apache.ant:ant-jsch:1.8.4'
customTask 'com.jcraft:jsch:0.1.49'
customTask group: 'pl.com', name:'MyCustomTask', version:'0.9', configuration: 'runtime'
}
task buildInstaller(type: eu.company.gradle.MyCustomTask) {
...
}
这是我的自定义任务:
package eu.company.gradle
class MyCustomTask extends DefaultTask {
public MyCustomTask() {}
@TaskAction
def build() {
// do something
}
}
依赖被下载,但是当我要运行“buildInstaller”的任务,我得到这个错误:
Could not find property 'pl' on root project 'Configurable installer'.
看起来我的jar不在classpath中?
好的,谢谢,但我的构建以这种方式工作,所以问题在哪里? – pepuch
它没有。注意'buildscript'块。 –
Ohhhhh,谢谢! – pepuch