如何使用依赖于常春藤导入的lib的Ant taskdef [英] How can I use an Ant taskdef that depends on lib imported by ivy

查看:66
本文介绍了如何使用依赖于常春藤导入的lib的Ant taskdef的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在build.xml中创建了一个taskdef,它依赖于由Ivy导入的jar中驻留的类.

I've created a taskdef in my build.xml that depends on a class that resides in a jar imported by Ivy.

鉴于我的构建在启动之前就中断了,因为它找不到taskdef的类,因此我想了解是否有任何可能.

I'd like to understand if it's possible in any way, given the fact that my build breaks before starting because it can't find the class for the taskdef.

这似乎是一个鸡蛋和鸡肉的问题,因为我不能上课,因为我必须先解决我的依赖关系(这需要构建才能起作用).

This seems a egg and chicken issue, as I can't get the class because I'd have to resolve my dependencies first (which needs the build to be working).

推荐答案

是的,有可能.但是,这意味着您必须在执行<taskdef>任务之前解析并检索jar.有两种方法可以做到这一点:

Yes, it is possible. However, it means that you must resolve and retrieve the jars before that <taskdef> task is executed. There are two ways to do this:

  • <typedef/>任务之前放置<ivy:resolve><ivy:retrieve>任务.这三个都可以在<target>之外.但是,在这种情况下,如果您运行 clean ,则这三个任务将首先在clean之前执行,这意味着简单的clean将花费更长的时间,并且必须确保您不这样做. clean<ivy:retrieve>期间所做的任何事情.

  • Put the <ivy:resolve> and a <ivy:retrieve> task before the <typedef/> task. All three can be outside of a <target>. However, in that case, if you run a clean, these three tasks will be executed first before the clean which means a simple clean will take longer, and you have to make sure you don't clean anything done during the <ivy:resolve> and the <ivy:retrieve>.

将所有三个对象放置在自己的目标中,然后使依赖于第三方jar的目标依赖于检索常春藤jar并定义任务的目标.对于诸如Ant-Contrib任务之类的东西几乎可以被所有任务使用的情况来说,这可能是困难的,但是对于诸如在构建过程结束时使用的某种打包任务之类的事情来说,这将变得更加容易.

Put all three in their own target, then make the target which is dependent upon that third party jar dependent upon the target that retrieves the Ivy jars and defines the task. This can be difficult with something like the Ant-Contrib tasks which may be used by almost all of the tasks, but should be easier with things like some sort of packaging task that's used at the very end of your build process.

这篇关于如何使用依赖于常春藤导入的lib的Ant taskdef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆