无法从父级解析 junit
我有父项目和 4 个子模块。我在父模块中添加了 junit 依赖项,如下所示:
<dependencys>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencys>
现在我正在子模块中测试一些 java 类,并且在 eclipse 中收到错误消息:
The import org.junit cannot be resolved
I have parent project and 4 children modules. I have added junit dependency in parent like this:
<dependencys>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencys>
Now I am testing some java classes in childreen modules and I get error messsage in eclipse:
The import org.junit cannot be resolved
Do I have to add junit dependency to all children modules or what is the best practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 junit 依赖项从 dependencyManagement 移动到依赖项应该可以解决问题
move junit dependency from dependencyManagement to dependencies should solve the problem