No, there’s no issue with test or non-test classes. The classes that are
complaining about org.mockito missing are test classes in src/test/java. The
org.mockito dependency is correctly specified as test scope.
There are also classes in src/main/java with compile errors. Of the ones that
I looked at, they are complaining about classes that should be generated from
soap wsdls, and I find those classes in target/classes.
I’ll provide the .classpath and .project files here.
----------------.classpath---------------
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry including="**/*.java" kind="src"
output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional"
value="true"/>
<attribute
name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src"
output="target/classes" path="src/main/resources">
<attributes>
<attribute
name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes"
path="src/test/java">
<attributes>
<attribute name="optional"
value="true"/>
<attribute
name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src"
output="target/test-classes" path="src/test/resources">
<attributes>
<attribute
name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute
name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con"
path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute
name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src"
output="target/classes" path="opt/ajsc/etc/config">
<attributes>
<attribute
name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="GROOVY_DSL_SUPPORT">
<attributes>
<attribute
name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
--------------------.project-------------------
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>platformpilotms</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
From: m2e-users <[email protected]> On Behalf Of Simon Niederberger
Sent: Saturday, June 26, 2021 11:06 PM
To: Maven Integration for Eclipse users mailing list <[email protected]>
Subject: Re: [m2e-users] Why is a project failing to find classes that are
clearly in maven dependencies?
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 <[email protected]<mailto:[email protected]>>
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
[email protected]<mailto:[email protected]>
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users<https://urldefense.com/v3/__https:/www.eclipse.org/mailman/listinfo/m2e-users__;!!BhdT!w2boElZzmTv3ff8grMwMivpZ_4e5e2_FxGwemzf2ONCyKsMyAgRHkVnkrk2unQ$>
_______________________________________________
m2e-users mailing list
[email protected]
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users