Is this a case of test scope? Classes under src/main will not have test-scoped JARs in their classpath. These test-scoped JARs are color-marked in the "Maven dependencies".
Is mockito test-scoped (as it should be), and your class using mockito under src/main instead of src/test? On Sun, Jun 27, 2021, 00:31 KARR, DAVID <dk0...@att.com> wrote: > I work on many SpringBoot projects that are built with Maven, and which > have been worked on in Eclipse. We are compiling projects with Java 8, but > I use close to the latest version of Java to run Eclipse. > > I'm looking at one project that is giving me problems. It has some > additional dependencies that are a little different from other services, > but I don't know if that's causing a problem. > > My current test case includes installing a fresh installation of Eclipse > 2021-03, installing several plugins, cloning the project from the git > repository, then importing the project from the git repository. This > results in numerous compile errors, mostly for missing classes, all of > which are clearly shown in the jars in the "Maven Dependencies" list. I > first noticed this problem using 2021-06, and I backtracked to 2021-03, but > it happens there also. > > The command line Maven build of "mvn clean package" completes without > error. > > As an example of the errors I see, the first compile error in the > "Problems" view shows a file where the first compile error in the file > refers to an import of "org.mockito.InjectMocks", and the error says "The > import org.mockito cannot be resolved". If I then go over to the package > explorer and inspect this project, expanding the "Maven Dependencies" item > in the tree, I can scroll through the many Maven dependencies until I find > "mockito-core-2.8.4.7.jar", which I can expand, showing "org.mockito", and > in that package I find the "InjectMocks" class, which I can open up to > inspect, which looks perfectly fine. > > I do note that in the "Maven Dependencies" list, some dependencies have an > icon that looks like a clear jar, and some look like a dark jar. This > dependency is one of the dark ones. Looking through the list, the dark > jars are less common than the clear jars, and I think that many of the > "clear" ones that I see are ones that I'm pretty sure are referenced, and > many of the dark jars are ones that I'm surprised to see, as I'm not aware > of any code of ours that uses it. Perhaps the "dark" jar means it's a > transitive dependency. I have no idea. I tried to find a mention of this > distinction on the internet, but I couldn't find any. > _______________________________________________ > m2e-users mailing list > m2e-users@eclipse.org > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/m2e-users >
_______________________________________________ m2e-users mailing list m2e-users@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/m2e-users