gradle:在单独的项目中定义Task类型

时间:2016-01-07 09:11:47

标签: gradle build.gradle

一个gradle项目:build.gradle

apply plugin: 'groovy'
apply plugin: 'maven'
version = '1.0'
group = 'davenkin'
archivesBaseName = 'hellotask'

repositories.mavenCentral()

dependencies {
    compile gradleApi()
    groovy localGroovy()
}
uploadArchives {
    repositories.mavenDeployer {
        repository(url: 'file:../lib')
    }
}

另一个gradle项目:build.gradle

buildscript {
    repositories {
        maven {
            url 'file:../lib'
        }

    }

    dependencies {
        classpath group: 'davenkin', name: 'hellotask', version: '1.0'
    }
}


task hello(type: davenkin.HelloWorldTask)

当我进入命令行时:gradle hello 错误:

* What went wrong:
A problem occurred evaluating root project 'gradle1'.
> Could not find property 'davenkin' on root project 'gradle1'.
谁能帮助我?

0 个答案:

没有答案