NetBeans 平台单元测试库依赖项
我正在开发 Netbeans 平台 RCP 应用程序。
我在单元测试中使用 jmock ,并且创建了一个库包装模块来导入必要的库。
该模块有一个名为“库”的部分和另一个名为“单元测试库”的部分。
我希望可以将 JMock 库包装器添加到“单元测试库”,但是当我运行单元测试时,我收到错误“包 org.jmock 不存在”。
如果我将 JMock 库包装器导入到主“库”元素中,那么它就可以工作,但这感觉不对。
Maven 允许我指定仅单元测试的依赖项,并且我假设 NetBeans Platform 也做了同样的事情。这应该可能吗?我做错了什么吗?我是否应该屈服于对单元测试库的运行时依赖(呃)。
I am working on a Netbeans Platform RCP application.
I use jmock in my unit tests and I have created a Library Wrapper Module to import the necessary libraries.
The Module has an section named 'Libraries' and another section named 'Unit Test Libraries'.
I hoped that I could add the JMock Library Wrapper to the 'Unit Test Libraries', however when I run the unit tests I get the error 'package org.jmock does not exist'.
If I import the JMock Library Wrapper in to the main 'Libraries' element then it works, but this feels wrong.
Maven allows me to specify unit-test only dependencies, and I assumed that NetBeans Platform did the same. Should this be possible? Am I doing something wrong? Should I resign myself to a run-time dependency on the unit-test libraries (ugh).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题。对项目(而不是模块)进行“清理并构建全部”后,一切正常。
I experienced the same issue. After doing a "Clean and Build All" on the project (not the module), everything worked fine.
使用库包装器作为测试依赖项应该可行;事实上,这就是 JUnit 本身的打包方式。按照之前的建议尝试干净的构建。
Using library wrappers as test dependencies ought to work; in fact this is how JUnit itself is packaged. Try a clean build as previously suggested.