Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在junit我的 Ant 脚本中编写一个任务,我看到文档说您可以同时指定.java和.class文件。
junit
.java
.class
为什么要指定.java文件?
该junit任务不编译源文件,因此没有任何好处。而且您已经必须在类路径中指定类文件。我想也许指定 java 源文件会导致我的堆栈跟踪显示行号,但实验表明这没有发生。
所以我很难过。有什么区别吗?事实上,它似乎不太方便。
指定.java文件有好处吗?
如果您有需要编译的源列表,则可以将其传递给 java 任务,该任务将编译它们。在这种情况下,能够将该列表传递给 junit 任务,而不必将所有 .java 文件名映射到 .class 文件名,这是一种(小)便利。