gpt4 book ai didi

gradle - 在gradle中重写从Ant导入的任务

转载 作者:行者123 更新时间:2023-12-03 06:02:35 26 4
gpt4 key购买 nike

我使用以下命令将ant脚本导入gradle构建:

ant.importBuild "build.xml"

我想使用gradle功能以更好的方式实现 runSth任务(存在于ant脚本中)。但是,当我尝试定义它时,我得到:
Cannot add task ':runSth' as a task with that name already exists.

如何在gradle脚本中覆盖Ant任务?

最佳答案

此问题已在gradle用户邮件列表(nabble archive)上解决。

亚当·默多克advices:

You can trick the AntBuilder into thinking it has already imported the 'clean' task before you do the import:


ant.project.addTarget('runSth', new org.apache.tools.ant.Target())
ant.importBuild(...)

为我工作。

关于gradle - 在gradle中重写从Ant导入的任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40577269/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com