我正在尝试使用groovy创建项目的Ant Build。我正在尝试使用AntBuilder在groovy中创建jar时“抓住:: jar不支持”destdir“属性”错误。
我的groovy文件如下
build.groovy
package com.groovy.core.utils
导入groovy.util.AntBuilder
class build {
def ant = new groovy.util.AntBuilder()
def base_dir = "C:/Users/abc/neon/GroovyAntDateUtils/"
def src_dir = base_dir + "src"
def lib_dir = "C:/Jars/groovy-2.4.12/lib"
def build_dir = base_dir + "com/groovy/core/utils"
def dist_dir = base_dir + "dist"
def file_name = "DateUtils"
/*, includeantruntime : "false"*/
static void main(args){
println("hi welcome to groovy");
def b = new build()
b.jar()
//b.run(args)
}
def classpath = ant.path {
fileset(dir: "${lib_dir}"){
include(name: "*.jar")
}
pathelement(path: "${build_dir}")
}
def clean(){
ant.delete(dir : "${build_dir}")
ant.delete(dir : "${dist_dir}")
}
def jar(){
clean()
buildFolder()
ant.mkdir(dir: "${dist_dir}")
ant.jar(destdir: "${dist_dir}/${file_name}.jar", basedir: "${build_dir}")
}
def compile(){
ant.javac(destdir: "${build_dir}", srcdir: "${src_dir}", classpath: "${classpath}")
}
def buildFolder(){
ant.mkdir(dir: "${build_dir}")
compile()
}
}
JDK - 1.8.0_121 蚂蚁&蚂蚁发射器 - 1.9.0 groovy - 2.4.12