Java Maven + Eclipse + junit: package not found

我是研究僧i 提交于 2020-03-25 13:58:28

问题


I have a project on eclipse in which junit is included as dependency in pom.xml:

   <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>

The project compiles well and dependency is properly resolved. I created my test folder under /src directory and added some class. However, the namespace org.junit cannot be found on my code until I "Fix project setup" to include JUnit4 Maven Dependency.

I think this should not be necessary since I included the dependency on the pom.xml. Right?

What I am doing wrong here?

来源:https://stackoverflow.com/questions/60776770/java-maven-eclipse-junit-package-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!