如何覆盖存储在 ant lib 目录中的 ant 任务 [英] How to override ant task stored in ant lib directory

查看:30
本文介绍了如何覆盖存储在 ant lib 目录中的 ant 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的工作中,我们在一些 Java 项目中使用 AspectJ.为了让它与 ant 构建一起工作,我们已经将 aspectjtools.jar 放在 ant/lib/中.

At my work we use AspectJ in some of our Java projects. To get this to work with ant builds we have been placing aspectjtools.jar within ant/lib/.

我现在正在处理一个特定的 Java 项目,需要使用较新版本的 aspectJ.我不想让使用该项目的每个人都更新他们的 aspectjtools.jar 本地副本.相反,我尝试将较新的 aspectjtools.jar 添加到项目的 lib 目录,并将以下行添加到 build.xml.

I am now working on a particular Java project and need to use a newer version of aspectJ. I don't want to have to get everyone who uses the project to update their local copy of aspectjtools.jar. Instead, I tried adding the newer aspectjtools.jar to the lib directory of the project and adding the following line to build.xml.

  <taskdef
     resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"
     classpath="./lib/aspectjtools.jar" />

然而,这并不像我希望的那样工作,因为 ANT 类加载器优先于我在 taskdef 类路径中指定的 jar 从 ant/lib/加载 jar.

However, this doesn't work as I hoped as the ANT classloader loads jars from ant/lib/ in preference to the jar I specify in the taskdef classpath.

有什么办法可以强制 ant 选择签入我项目的 jar 吗?

Is there any way to force ant to pick the jar checked into my project instead?

推荐答案

我的问题的最终答案是否定的.目前 ANT 无法优先使用项目中的任务 jar 而不是 ANT lib 目录中的任务 jar.

The ultimate answer to my question is no. The is currently no way for ANT to use a task jar from a project in preference to a task jar in the ANT lib directory.

这篇关于如何覆盖存储在 ant lib 目录中的 ant 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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