我正在寻找良好且实用的资源来帮助我有效地使用 Ant API。项目网站只提供了API的文档,根本没有用处。似乎很少有网站提供有关该主题的非常简短的教程。
我是否错过了一些资源?如何使用 Ant API 来执行简单的任务,而无需花费数小时浏览它们并查看源代码?
谢谢。
(对之前提出的问题的回答没有帮助 - 我如何以编程方式使用 Apache ANT)
I am looking for good and practical resources that will help me use the Ant APIs effectively. The project website just gives the documentation of the API which is not useful at all. Very few websites seem to give very brief tutorials on the subject.
Is there some resource I am missing out on? How can I use the Ant APIs for simple tasks, without spending hours browsing through them and looking at source code?
Thanks.
(Answers to previously asked questions not helpful - How can i use Apache ANT Programmatically )
发布评论
评论(3)
事实证明,缺乏使用 Ant API 的优质资源是众所周知的,也是有意为之的。
Ant 的这篇文章的底部段落说 -
您可能面临的问题此时问自己的是:我如何知道必须调用哪些类和方法才能设置虚拟项目和目标?答案是:你不知道。最终,您必须愿意亲自尝试并阅读源代码。上面的例子只是为了激发您的兴趣并帮助您入门。加油!
所以这似乎是充分利用 API 的唯一方法。
As it turns out, the lack of good resources on using the Ant API, is known and intended.
The bottom paragraph of this article from the Ant says -
The question you are probably asking yourself at this point is: How would I know which classes and methods have to be called in order to set up a dummy Project and Target? The answer is: you don't. Ultimately, you have to be willing to get your feet wet and read the source code. The above example is merely designed to whet your appetite and get you started. Go for it!
So this seems to be the only way to make best use of the API.
如果您只需要编译/Jarring 并且可以在 SDK 中运行它(而不是普通的 JRE),请查看 JavaCompiler 类进行编译。然后使用Jar相关的类来构建Jars。
所有J2SE。不包括 Ant,不需要 Ant。
If compiling/Jarring is all you need and you can run it in an SDK (as opposed to a plain JRE), look to the JavaCompiler class for compilation. Then use the Jar related classes to build the Jars.
All J2SE. Ant not included, Ant not required.
要理解 ANT,没有比以下更好的手册了: http://ant.apache.org/manual/index .html
我不确定您是否浏览过此链接详细解释了如何创建任务。需要注意的是,如果您是 ANT 新手,则没有简单的方法可以跳过本教程。来这里之前最好先了解一下基础知识。请参阅上面的链接以获得良好的起点。
There is no better manual to understand ANT than : http://ant.apache.org/manual/index.html
I am not sure if you've gone through this link that explains in detail about creating a task. A word of caution, If you're new to ANT, there is no easy way to jump on this tutorial. Better to learn the basics before you come here. Refer above link for a good starting point.