问题标签 [ant]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
2903 浏览

eclipse - Eclipse 3.3.2/MyEclipse doesn't recognize xml as ant files

Using eclipse 3.3.2 with MyEclipse installed. For some reason if a file isn't called build.xml then it isnt' recognised as an ant file. The file association for *.xml includes ant and says "locked by 'Ant Buildfile' content type.

The run-as menu is broken. Even if the editor association works run-as doesn't.

The ant buildfiles in question are correctly formatted. They work fine if you call them build.xml or if you use them anywhere else. Eclipse just won't recognise and thus wont allow you to run them.

0 投票
14 回答
24867 浏览

javascript - 使用 JavaScript 进行自动化单元测试

我正在尝试将一些 JavaScript 单元测试合并到我的自动化构建过程中。目前 JSUnit 与 JUnit 配合得很好,但它似乎是废弃软件,缺乏对 Ajax、调试和超时的良好支持。

有没有人有幸(使用Ant)自动化单元测试库,例如YUI测试、jQuery 的QUnitjQUnit

注意:我使用自定义构建的 Ajax 库,因此 Dojo 的 DOH 的问题在于它要求您使用自己的 Ajax 函数调用和事件处理程序来处理任何 Ajax 单元测试。

0 投票
7 回答
4332 浏览

java - Ant Junit tests are running much slower via ant than via IDE - what to look at?

I am running my junit tests via ant and they are running substantially slower than via the IDE. My ant call is:

The same test that runs in near instantaneously in my IDE (0.067s) takes 4.632s when run through Ant. In the past, I've been able to speed up test problems like this by using the junit fork parameter but this doesn't seem to be helping in this case. What properties or parameters can I look at to speed up these tests?

More info:

I am using the reported time from the IDE vs. the time that the junit task outputs. This is not the sum total time reported at the end of the ant run.

So, bizarrely, this problem has resolved itself. What could have caused this problem? The system runs on a local disk so that is not the problem.

0 投票
5 回答
4425 浏览

java - 在ant中无条件执行任务?

我正在尝试定义一个在目标完成执行时发出(使用回显)消息的任务,无论该目标是否成功。具体来说,目标执行一个任务来运行一些单元测试,我想发出一条消息,指示结果在哪里可用:

不幸的是,如果测试失败,任务就会失败并且执行会中止。因此,只有在测试通过时才会输出消息——这与我想要的相反。我知道我可以把任务放在任务之前,但这会让用户更容易错过这条消息。我正在尝试做的事情可能吗?

更新:事实证明我很愚蠢。我的 <testng> 任务中有 haltOnFailure="true" ,这解释了我看到的行为。现在的问题是,即使测试失败,将其设置为 false 也会导致整个 ant 构建成功,这不是我想要的。下面使用任务的答案看起来可能是我想要的..

0 投票
3 回答
4275 浏览

regex - 如何在 Ant 'ReplaceRegExp' 任务中执行数学函数?

我需要在 Ant 构建脚本的源文件中增加一个数字。我可以使用该ReplaceRegExp任务来查找我想要增加的数字,但是我如何在replace属性中增加该数字?

这是我到目前为止所得到的:

在替换属性中,我该怎么做

我不能使用该buildnumber任务将值存储在文件中,因为我已经在同一个构建目标中使用它。是否有另一个 ant 任务可以让我增加属性?

0 投票
3 回答
20585 浏览

java - Ant 和可用任务 - 如果某些东西不可用怎么办?

当我使用该任务时,该属性仅在资源(例如文件)可用时才设置为 TRUE。如果不是,则该属性未定义。

当我打印属性的值时,如果资源可用,则返回 true,否则只打印属性名称。

如果资源不可用,有没有办法将属性设置为某个值?我曾尝试在可用检查之前明确设置属性,但随后 ant 抱怨:

0 投票
1 回答
867 浏览

ant - 我可以使用 ANT 任务更新签名的 jar 吗?

您好我正在尝试使用 webstart 部署应用程序。我需要更新一个在我实际部署之前签名的 jar(基本上是为了更新 IP/端口信息)。我正在尝试使用 ANT 来更新 jar。有没有办法做到这一点?

0 投票
4 回答
2437 浏览

.net - 是否有显示所有属性名称/值的 NAnt 任务?

是否有一个 NAnt 任务会回显当前在构建期间设置的所有属性名称和值?可能相当于 Ant echoproperties任务的东西?

0 投票
8 回答
4149 浏览

java - 在 Linux 上使用 ANT、Javacc、JUnit 和编译 Java 类加快构建时间的技巧

我们有一个庞大的代码库,在开发人员机器上大约需要 12 分钟才能使用 JavaCC 自动生成一些 Java 5 类,然后编译所有类并运行单元测试。

该项目由多个可以分组构建的项目组成,但我们的目标是在 10 分钟内完成一个完整的构建

有什么技巧可以减少此构建时间?

谢谢

0 投票
2 回答
4036 浏览

java - 使用 ANT 时,如果我有一些特定的 java 版本,如何定义任务?

我的问题是,只有在构建计算机中安装了 Java 1.5 时,才能执行 Ant 中的特定步骤。任务定义使用使用 1.5 编译的 jar 文件,因此使用 1.4 虚拟机运行会抛出 IncompatibleClassVersion 异常。

我必须同时找到一个解决方案才能让这个任务为这个需要 1.4 的特定项目工作,但是我遇到了一个问题。如果我没有特定的 java 版本,如何避免定义此任务并执行此可选步骤?

我可以在目标标签上使用“if”或“unless”标签,但它们只检查是否设置了属性。我也想有一个不需要额外库的解决方案,但我不知道标准中的内置功能是否足以执行这样的任务。