Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Why is a project failing to find classes that are clearly in maven dependencies?
  • From: "KARR, DAVID" <dk068x@xxxxxxx>
  • Date: Sun, 27 Jun 2021 06:25:45 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=att.com; dmarc=pass action=none header.from=att.com; dkim=pass header.d=att.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7byEeaweCe9fgQkguMiuDfAMeRzCqCrVvs0Q8HSMZZk=; b=K4uHnv9+xeshHtAq1Z2Jv52fbqVUBpOPuTtpClHJ3TP1pi/SBpHTRSmTkvrT3CU/UL25ExhFYSVuYdP/3fFjGseOA9bMr0Lnx4ze90KtmnESIJ1YM4Y5LWiantNQ3rYKj6RfsKMqe2TbRuFu/a73sOP6EPygeytrBIoMtruyIcfTSCF3XlnZfgb4i+9OqTwgbpAM8+O/JD2KI5kzdmR5epQ3SjBOIQrjaOytxLpu1iLYohEc7yj/fvLH2foF8LSNFk58vbvS9QD7Qoy13AjTo3tkZt2NQmV4LVUUqLK5u71vwf5ifH46sW1Lrm90twpBOjBzG0ipIMxaCg/vyUxFLg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TL3agdny3yVZrLEKEbSeRKZ6eFSvvtKZDhj2TAiMvKebEWvk5dOv9tb23jvYFm2js+k4FzGoYttwc8rgC1xUGUhubQ38qzhmpZfKUYk67Qlap56def1iFYlppDt5sAEasaf+QPk96H+lZRyBR3LxJIEMXFsSYBjcx6cq2EVW1YR1Qga/CTp3HfFxI5vry1AoWKhB+pTh8vmI0DAeGCiTbrgWuqdCWbHimarlQNG1eFkB50gXXyroXPyD7y0pBDwyFHwGJMcd7Wr1tpOPKvmYJCYp+tB9vuMLyfKwtge/Gnngq6ratPekCPNsC3eSfBkK7FKVLAD5OYo8fhuxTpYHBA==
  • Delivered-to: m2e-users@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/m2e-users/>
  • List-help: <mailto:m2e-users-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/m2e-users>, <mailto:m2e-users-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/m2e-users>, <mailto:m2e-users-request@eclipse.org?subject=unsubscribe>
  • Thread-index: Addq4WEmgfc8dBInTDq2cadG9Swa/wAOSXqAAAAzUIA=
  • Thread-topic: [m2e-users] Why is a project failing to find classes that are clearly in maven dependencies?

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 <m2e-users-bounces@xxxxxxxxxxx> On Behalf Of Simon Niederberger
Sent: Saturday, June 26, 2021 11:06 PM
To: Maven Integration for Eclipse users mailing list <m2e-users@xxxxxxxxxxx>
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 <dk068x@xxxxxxx> 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@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/m2e-users


Back to the top