将用户库添加到 Ant Builder 类路径 [英] Add user libraries to Ant Builder classpath

查看:40
本文介绍了将用户库添加到 Ant Builder 类路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为 Eclipse 项目设置 Ant Builder 时遇到问题.

I am having a problem with setting up an Ant Builder for my Eclipse projects.

我确实有几个 3rd 方库配置为 Eclipse 中的用户库.这些库已添加到我的项目的构建路径中,并且一切正常.

I do have several 3rd party libs configured as user libraries within Eclipse. Those libraries are added to the build path of my projects and everything is working fine.

我的问题是,如果我想从 Eclipse 使用 Ant Builder,我必须将一些用户库添加到 Ant Builder 的类路径中才能使其工作.我需要那些 Libs,因为它们包括几个任务定义和 Ant 的类型定义,而不是编译我的项目.但是如何将这些用户库添加到 Ant Builder 类路径中?我不想通过手动添加来硬编码"它们,因为如果我将来必须更改这些库中的一个,我还必须维护所有 Ant Builder.而且我不知道负载如何在 Ant 中确定运行时用户库的路径以动态加载它们,因为我需要 Ant 引导程序中的那些库才能成功定义我需要的 Ant 任务.

My problem is, that if I want to use the Ant Builder from Eclipse, I will have to add some of the user libraries to the classpath of the Ant Builder to get it working. I need those Libs because they include several task defs and type defs for Ant, NOT TO COMPILE MY PROJECTS. But how can I add those user libraries to the Ant Builder classpath? I don't want to "hard-code" them by adding them manually, because if I must change one those libs in the future, I will also have to maintain all Ant Builders. And I dont't know how load determine the path to the user libraries at runtime within Ant to load them dynamically, because I need those libs at the bootstrap of Ant to be able to define my needed Ant Tasks successfully.

推荐答案

在这种情况下,您可能希望将 JAR 文件(包含 taskdef)添加到 Ant 运行时.

In that case, you may wish to add your JAR files (containing the taskdefs) to the Ant runtime.

Window -> Preferences,从左边选择Ant -> Runtime".关注全局条目",然后使用右侧的添加 JAR"按钮添加 JAR 文件.

Window -> Preferences, select "Ant -> Runtime" from the left. Focus on "Global Entries", then use the "Add JAR" button on the right to add JAR files.

您添加的 JAR 文件将贡献给在 Eclipse 下运行的任何 Ant 进程.

The JAR files you add will be contributed to any Ant process running under Eclipse.

您的下一个问题可能是 - 为什么我必须添加 JAR?我不能添加我的用户库吗?".好问题,很高兴你(几乎要)问.也让我发疯,我不知道为什么 Eclipse 不提供此功能.也许是时候打开功能请求了...

Your next question might be - "why do I have to add JARs? Can't I add my user library?". Good question, glad you (were almost about to) asked. Drives me bonkers too and I have no idea why Eclipse doesn't provide this functionality. Maybe it's time to open a feature request...

编辑 2014 年 2 月:原来已经请求将用户库添加到 Ant 的类路径 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=211669).看样子,我是重新打开它的人...

Edit February 2014: turns out that adding user libraries to Ant's classpath has already been requested (https://bugs.eclipse.org/bugs/show_bug.cgi?id=211669). By the looks of it, I was the one who reopened it...

这篇关于将用户库添加到 Ant Builder 类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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