Eclipse 类路径条目仅用于测试 [英] Eclipse classpath entries only used for tests

查看:25
本文介绍了Eclipse 类路径条目仅用于测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Maven 中,您可以拥有 compile-time 依赖项和 test 依赖项.这是我喜欢的一个特性,M2Eclipse 插件也使 Eclipse 可以使用它,这很棒.因此,如果我将 jmock.jar 作为测试依赖项添加到我的项目中,它将显示在 JUnit 测试的类路径中,但在我调试应用程序本身时不会出现.>

这正是我现在想要实现的,但没有 M2Eclipse 或 Maven.有没有办法在普通的 Eclipse 中做到这一点?(可能无需安装任何插件.)

解决方案

恐怕答案是你不能.有 2 个未解决的问题从 3.5 推迟到与您的问题相关:

In Maven, you can have compile-time dependencies and test dependencies. This is a feature I love, and the M2Eclipse plugin makes this available in Eclipse, too, which is great. So if I add jmock.jar to my project as a test dependency, it will show up on the classpath for JUnit tests, but won't be present when I'm debugging the application itself.

This is exactly what I'd like to achieve now, but without M2Eclipse or Maven. Is there a way to do this in plain Eclipse? (Possibly without installing any plugins.)

解决方案

I'm afraid the answer is that you can't. There are 2 open issues which were postponed from 3.5 related to your problem:

这篇关于Eclipse 类路径条目仅用于测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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