运行摇篮Ant脚本 [英] Run Ant script from Gradle
问题描述
我试图从摇篮运行ant脚本,但我有此异常:
I'm trying to run ant script from Gradle, but I have this exception:
Cause: the class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.
和我宁愿使用蚂蚁junit的本地库,但我不知道怎么样,我是pretty新摇篮。
And I'd rather use ant-junit from local libs, but I do not know how, I am pretty new to Gradle.
我发现这个code
configurations {
antClasspath
}
dependencies {
antClasspath 'org.apache.ant:ant-junit4:1.8.3'
}
ClassLoader antClassLoader = org.apache.tools.ant.Project.class.classLoader
configurations.antClasspath.each { File f ->
antClassLoader.addURL(f.toURI().toURL())
}
但我不知道我有什么改变,如果罐子已经在MT lib文件夹。我不想使用Maven的回购协议。
But I don not know what I have to change if the jar is already in mt lib folder. I do not want to use maven repo.
推荐答案
这是刚刚从评论,这解决了我的问题转贴:感谢的蛋白石
This is just repost from comment, which solved my problem: Thanks to Opal
无网连接的Gradle运行可能不是一个很好的主意。不过,如果你有罐子,您需要在本地目录,只需添加id来使用脚本文件相关性依赖。请参阅:的http://www.gradle.org/docs/current/userguide/dependency_management.html#file-dependencies从蛋白石
Running gradle without net connection may not be a very good idea. Nevertheless if You have the jar You need in the local directory, just add id to script dependencies using file dependencies. See: http://www.gradle.org/docs/current/userguide/dependency_management.html#file-dependencies from Opal
这篇关于运行摇篮Ant脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!