tasks.setupAll.dependsOn(copyJars)在gradle中不工作?
我试着在这里找到答案 但它失败了 在任务集上找不到属性“setupAll” 我试过一些东西tasks.setupAll.dependsOn(copyJars)在gradle中不工作?,gradle,Gradle,我试着在这里找到答案 但它失败了 在任务集上找不到属性“setupAll” 我试过一些东西 使子项目部分中的任务依赖于master:copyJars,但失败 下面的解决方案 脱掉那些不起作用的任务 我只有一个build.gradle文件和settings.gradle文件。设置梯度文件是 include 'master', 'toneserver','webserver' 主build.gradle文件是(具体地说,搜索setupAll的两个实例,因为不知何故该文件有问题) //注意:当前此
include 'master', 'toneserver','webserver'
主build.gradle文件是(具体地说,搜索setupAll的两个实例,因为不知何故该文件有问题)
//注意:当前此文件仅用于依赖项管理,但我们希望
//将所有构建从ant文件转换为gradle。我们需要添加依赖项
//管理层也这样做,将gradle first作为进化过程中的第一步
所有项目{
应用插件:“java”
应用插件:“eclipse”
buildDir='output'
task hello println“我是$task.project.name”}
build println“MASTER:我正在构建classpath=$sourceset.main.compileClasspath.files”}
}
项目(“:toneserver”){
依赖关系{
编译文件树(目录:“play-1.2.4/framework/lib”,包括:“*.jar”)
编译文件树(目录:“play-1.2.4/framework”,包括:“*.jar”)
编译项目(“:master”)
编译项目(':webserver')
}
任务eclipse(覆盖:true){
}
}
项目(':webserver'){
依赖关系{
编译文件树(目录:“play-1.2.4/framework/lib”,包括:“*.jar”)
编译文件树(目录:“play-1.2.4/framework”,包括:“*.jar”)
编译项目(“:master”)
}
//playframework有自己生成的.classpath和.project文件,所以不需要
//覆盖他们的版本
任务eclipse(覆盖:true){
}
}
项目(':master'){
project.ext.genLibDir=文件('lib')
project.ext.fixedLibDir=文件('libother')
存储库{
mavenCentral()
}
依赖关系{
编译组:“org.hibernate”,名称:“hibernate entitymanager”,版本:“4.1.4.Final”
编译组:“org.slf4j”,名称:“slf4j api”,版本:“1.6.6”
编译组:“org.slf4j”,名称:“log4j-over-slf4j”,版本:“1.6.6”
编译组:“ch.qos.logback”,名称:“logback core”,版本:“1.0.6”
编译组:“joda time”,名称:“joda time”,版本:“2.1”
编译组:“com.google.inject”,名称:“guice”,版本:“3.0”
编译组:'com.google.protobuf',名称:'protobufjava',版本:'2.4.1'
//即将被抹去
编译组:'commons-configuration',名称:'commons-configuration',版本:'1.8'
编译组:“org.jboss.netty”,名称:“netty”,版本:“3.2.7.Final”
//编译组:“org.asteriskjava”,名称:“asteriskjava”,版本:“1.0.0.M3”
编译文件树(目录:project.ext.fixedLibDir,包括:'*.jar')
}
任务('copyJars'){
ext.collection=文件{genLibDir.listFiles()}
删除外部集合
将{从configurations.compile复制到genLibDir}
将{从fixedLibDir复制到genLibDir}
}
tasks.setupAll.dependsOn(copyJars)
}
子项目{
版本='Developer Build'
//配置.compile{
//排除组:“javax.jms”,模块:“jms”
//排除组:“com.sun.jdmk”,模块:“jmxtools”
//排除组:“com.sun.jmx”,模块:“jmxri”
//}
任务('setupAll',dependsOn:['eclipse']){
description='从远程存储库更新JAR,然后修复主项目的eclipse类路径'
}
hello没关系,愚蠢的错误,忘记了我的任务在子项目中,应该在外部并且需要a:那么新的setupAll在子项目之外,并且是
task('setupAll', dependsOn: [':master:copyJars', 'eclipse']) {
description = 'Update jars from remote repositories and then fix eclipse classpath for master project'
}
task('setupAll', dependsOn: [':master:copyJars', 'eclipse']) {
description = 'Update jars from remote repositories and then fix eclipse classpath for master project'
}