首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在groovy中使用AntBuilder创建jar

无法在groovy中使用AntBuilder创建jar
EN

Stack Overflow用户
提问于 2017-08-28 21:14:42
回答 1查看 376关注 0票数 2

我正在尝试使用groovy创建我的项目的Ant构建。当我尝试在groovy中使用AntBuilder创建jar时,我得到了"Caught::jar jar support the "destdir“attribute”错误。

我的groovy文件如下

build.groovy

包com.groovy.core.utils

导入groovy.util.AntBuilder

类生成{

代码语言:javascript
复制
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 ant & ant launcher -1.9.0groovy- 2.4.12

EN

回答 1

Stack Overflow用户

发布于 2017-08-28 21:33:56

jar任务没有destdir属性

https://ant.apache.org/manual/Tasks/jar.html

也许你想要destfile

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45919968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档