English 中文(简体)
如何选择或更改 Eclipse 中的 JUnited 版本?
原标题:How to select or change JUnit version in Eclipse?

基本上我使用的源代码 需要一个非常具体的 JUM 测试版本,例如:

lucene-test-framework-XX.jar
  The compiled Lucene test-framework library.
  Depends on junit 4.10.x (not 4.9.x, not 4.11.x), and Apache Ant 1.7.x (not 1.6.x, not 1.8.x)

然而,我是新来日光城的,我在哪里以及如何把JUM换成4.10.x?

提前多谢了!

最佳回答

过去,我改变了我的计划,具体地(具体地)删除了前一项,然后在我的项目属性图书馆设置中添加了专门的 JUM(外部) JAR。

  1. Project > Properties > Java Build Path > Libraries
  2. Click "Add External JARs..." button at right side --> Select your preferred JUnit jar
  3. Click OK button


(source: aggroculture.com)

问题回答

虽然问题在于如何使用一个非常特殊的版本,但问题的标题对于在JUM3和JUM4之间切换也有效。 答案说明了如何做到这一点。

由于junit 图书馆是日食分布的一部分已有相当长的时间了。 在日食开普勒,我们可以在JUM3 和 JUM4 之间转换,两者都由有效的JUnit 4.11单元(因为JUM3仍然与JUnid4兼容)所覆盖。

右键点击您的工程, 选择 BuildPath/ ConfigureBudildPath, 并选择标签库 。 假设已列出图书馆 JUM3, 您想要切换到 JUM4 。 选择条目 JUM3, 然后按“ 取消” 键, 然后“ 添加库 ” 。 在下面的向导中, 您在下调中选择“ JUM ” 、 “ 下一步 ” 、 “ JUM4 ” 和“ 结束 ” 。

或许你在项目探索者中注意到J United4-Library(与J United3不同)也包含杂草核心图书馆(提供强大的匹配者)。

问题在于,至少在Eclipse Luna SR1/SR2中, Eclipse似乎在“eclipse/plugins/org.junit_4.11.0.v201303003030”中将JUM4.11的包装插件优先排序。 即使尝试了 的回答来强制使用我需要的版本, 我仍然收到同样的测试错误, 所以Junit 4. 11似乎仍在使用中。

迄今为止,我唯一有效的解决办法是用我想要的版本取代该目录中的junit.jar(eclipse/plugins/org.junit_4.11.0.v201303080030)。





相关问题
In Eclipse, why doesn t "Show In" appear for non-Java files?

If I have a *java file open, I can right click on the source, scroll down to "Show In (Alt-Shift-W)", and select Navigator. If I have an *xml, *jsp, or pretty much anything besides a Java source ...

Eclipse: Hover broken in debug perspective

Since upgrading Eclipse (Galileo build 20090920-1017), hover in debug no longer displays a variable s value. Instead, hover behaves as if I were in normal Java perspective: alt text http://...

Eclipse smart quotes - like in Textmate

Happy Friday — Does anyone know if eclipse has the notion of smart quotes like Textmate. The way it works is to select some words and quote them by simply hitting the " key? I m a newbie here so be ...

Indentation guide for the eclipse editor

Is there a setting or plugin for eclipse that can show indentation guides in the editor? Something like the Codekana plugin for visual studio (not so fancy is also OK). Important that it works with ...

Adding jar from Eclipse plugin runtime tab

I want to add .jar files for plugin from the Runtime tab of manifest file. When I use the Add... button, I can see only sub-directories of the plugin project. So if I want to add same .jar file to ...

How to copy multiple projects into single folder in eclipse

I have two projects, Project1 and Project2. Now i want to copy this projects into eclipse workspace but i want these projects to be in a single folder like below. Eclipse Workspace -> Project -> ...

Java: Finding out what is using all the memory

I have a java application that runs out of memory, but I have no idea which code is allocating the memory. Is there an application with which I can check this? I use Eclipse.

热门标签