使用 Ivy 下载/安装 ant-contrib、bsf、beanshell、commons-logging
我正在使用 Ant 和 Ivy 构建一个项目。 build.xml
文件依赖于 ant-contrib,bean 脚本框架,beanshell 和 commons-logging。
Ant 在多个位置搜索库,包括 ${user.home}/.ant/lib
。
如果没有,build.xml
文件中是否有任何方法可以自动下载这些库并将其安装在 ${user.home}/.ant/lib
目录中已经存在,也许使用 Ivy 本身?
谢谢,拉尔夫
I am building a project using Ant and Ivy. The build.xml
file depends on ant-contrib, bean scripting framework, beanshell, and commons-logging.
Ant searches for libraries in several places, including ${user.home}/.ant/lib
.
Is there any way in the build.xml
file to have these libraries automatically download and install in the ${user.home}/.ant/lib
directory if they are not already present, perhaps using Ivy itself?
Thanks, Ralph
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ant 库中唯一需要的 jar 是 ivy :-)
在 ivy.xml 文件中正常声明依赖项。利用配置将与 ANT 任务关联的 jar 文件集中分组:
在 build.xml 文件中,您可以从此配置创建路径
The only jar you need in your ant lib is ivy :-)
Declare your dependencies as normal within your ivy.xml file. Make use of a configuration to collectively group the jars associated with ANT tasks:
In your build.xml file you can create a path from this configuration
我在阅读 ivy 缓存文件集文档,其中指出:
Ivy 缓存路径文档类似地指出:
因此,似乎更好的答案是修改 Mark 对将检索与 ant 路径结合使用的内容的响应。大致如下:
Mark's Response (modified)
在您的 build.xml 文件中,您可以从此配置创建一个路径。
这甚至允许您将检索任务移动到处理依赖项的单独 ant 文件中。因此,在将依赖项检索到其目录中后,您不必依赖 ivy。
ivy 的目的是让你用它来拉下你的 jars(解析和检索)。一旦它们就位,您就可以切换回使用标准 Ant。
Note: I would just pull these dependencies into the lib directory. That would simplify the retrieve task:
另请注意:请访问本页的“类路径结构”部分,了解有关“标准”的更多信息蚂蚁路径创建”
I happened on this question as I was reading the Ivy cachefileset documentation, which states:
The Ivy cachepath documentation similarly states:
So, it would seem a better answer would be to modify Mark's response to something that uses retrieve in conjunction with ant paths. Something along the lines of the following:
Mark's Response (modified)
In your build.xml file you can create a path from this config
This would even allow you to move the retrieve task into a separate ant file that deals with dependencies. Thereby, you don't have to rely on ivy after your dependencies are retrieved into their directories.
The intention of ivy is that you use it to pull down your jars (resolve & retrieve). Once you have them in place, you can switch back to using standard Ant.
Note: I would just pull these dependencies into the lib directory. That would simplify the retrieve task:
Also Note: visit the 'Path-like Structures' section of this page for more on "standard ant path creation"
我会使用 ant 来安装所有内容 INTO ant =D
只需使用 dependent="init-ant-contrib, init-ivy"
现在您已经有了 ant-contrib & ivy,其他一切都应该是一个简单的 ivy.xml & ivy-resolve away:
我确信您可以找到类似的方法来安装您可能需要的任何 ant 任务。
I'd use ant to install everything INTO ant =D
Just use depends="init-ant-contrib, init-ivy"
Now that you have ant-contrib & ivy, everything else should be a simple ivy.xml & ivy-resolve away:
I'm sure you can find similar methods of installing whatever ant task you might need.