I think this issue was not what I thought it was.  I just discovered while I’ve 
been working on this that someone had pushed some clearly broken code to this 
repo, which may have been after I verified it from a command-line build and 
before I imported it into an Eclipse project.  I often do a git pull before I 
do certain operations, as I have it bound to a key sequence.  The broken change 
was putting a unit test class into src/main/java (which resulted in a flaming 
note from me). In all of my inspections of the compile errors in Eclipse, I 
didn’t notice that obvious problem. That error lies exactly in line with the 
theory mentioned here about test scope.

From: m2e-users-boun...@eclipse.org <m2e-users-boun...@eclipse.org> On Behalf 
Of Simon Niederberger
Sent: Sunday, May 26, 2019 4:42 AM
To: Maven Integration for Eclipse users mailing list <m2e-users@eclipse.org>
Subject: Re: [m2e-users] Why is one maven project imported into Eclipse unable 
to see JUnit or Mockito artifacts?

Maybe you have some standalone util classes + tests in the project to try out 
first? Also, could there be a version conflict so that you'r pulling JUnit 5 
while the tests are written for JUnit 4 (or vice versa)?

About your earlier "In any case, I wouldn’t think this would matter at all". 
I'm not sure how obvious this is, but starting with Eclipse Photon the Eclipse 
compiler distinguishes between test-scope and "normal"-scope. A class in a 
folder with "Contains test sources: No" will not see Maven artefacts imported 
with scope=test.


On Sun, May 26, 2019 at 6:50 AM KARR, DAVID 
<dk0...@att.com<mailto:dk0...@att.com>> wrote:
Good question.  The errors do appear when I add the source files back.  Now I 
guess I’m looking at some sort of bisect process, with 291 source files, and 
over 31k lines.  Yay.


From: m2e-users-boun...@eclipse.org<mailto:m2e-users-boun...@eclipse.org> 
<m2e-users-boun...@eclipse.org<mailto:m2e-users-boun...@eclipse.org>> On Behalf 
Of Fred Bricon
Sent: Saturday, May 25, 2019 8:20 PM
To: Maven Integration for Eclipse users mailing list 
<m2e-users@eclipse.org<mailto:m2e-users@eclipse.org>>
Subject: Re: [m2e-users] Why is one maven project imported into Eclipse unable 
to see JUnit or Mockito artifacts?

So if you add all sources back the error shows up?

On Sat, May 25, 2019 at 9:56 PM KARR, DAVID 
<dk0...@att.com<mailto:dk0...@att.com>> wrote:
Well, the first thing I tried in the copy was deleting all of the source files, 
leaving the pom file, then added a hello world java and test class.  I then 
built it from the command line, and it was successful. I then imported it to 
Eclipse as an Existing Maven Project.  No errors.

So, I then deleted the original imported project, removed the dot files, then 
instead of importing from the git repository, I imported as “Existing Maven 
Project”.  Same compile errors.

This points to something in the source files themselves as causing this.  I 
can’t really provide these source files.  Any idea of anything I can look for?

From: m2e-users-boun...@eclipse.org<mailto:m2e-users-boun...@eclipse.org> 
<m2e-users-boun...@eclipse.org<mailto:m2e-users-boun...@eclipse.org>> On Behalf 
Of KARR, DAVID
Sent: Saturday, May 25, 2019 8:14 AM
To: Maven Integration for Eclipse users mailing list 
<m2e-users@eclipse.org<mailto:m2e-users@eclipse.org>>
Subject: Re: [m2e-users] Why is one maven project imported into Eclipse unable 
to see JUnit or Mockito artifacts?

That’s going to be pretty unlikely, but if I don’t get any other ideas I’ll try 
copying this project and pulling everything I can out of it.

From: m2e-users-boun...@eclipse.org<mailto:m2e-users-boun...@eclipse.org> 
<m2e-users-boun...@eclipse.org<mailto:m2e-users-boun...@eclipse.org>> On Behalf 
Of Fred Bricon
Sent: Saturday, May 25, 2019 7:58 AM
To: Maven Integration for Eclipse users mailing list 
<m2e-users@eclipse.org<mailto:m2e-users@eclipse.org>>
Subject: Re: [m2e-users] Why is one maven project imported into Eclipse unable 
to see JUnit or Mockito artifacts?

can you provide a sample project reproducing this issue?

On Sat, May 25, 2019 at 10:56 AM KARR, DAVID 
<dk0...@att.com<mailto:dk0...@att.com>> wrote:
The “Sources” entry for “src/test/java” has “Contains test sources: Yes”.

The effective pom shows the “junit” artifact with “<scope>test</scope>”.  
Curiously, the same search for “mockito-core” doesn’t find a scope attribute.  
However, when I search for mockito in “Dependency Hierarchy”, I see that the 
artifact that references mockito is in scope test, and it displays mockito-core 
in scope test also.  In any case, I wouldn’t think this would matter at all.  
If the artifact is present at all, whether in scope test or not, I wouldn’t see 
compile errors saying the artifact is not found.

And remember that the command-line “mvn” build works fine. I’ve tested this 
both outside of Eclipse in a shell window, and in Eclipse, with “Run As Maven 
Build”.

From: m2e-users-boun...@eclipse.org<mailto:m2e-users-boun...@eclipse.org> 
<m2e-users-boun...@eclipse.org<mailto:m2e-users-boun...@eclipse.org>> On Behalf 
Of Simon Niederberger
Sent: Saturday, May 25, 2019 1:37 AM
To: Maven Integration for Eclipse users mailing list 
<m2e-users@eclipse.org<mailto:m2e-users@eclipse.org>>
Subject: Re: [m2e-users] Why is one maven project imported into Eclipse unable 
to see JUnit or Mockito artifacts?

Are your test classes on a path marked as Java Build Path -> Sources -> 
Contains test sources: Yes ? (And can you confirm that JUnit / Mockito are 
defined in scope=test in your pom.xml ?



On Sat, May 25, 2019 at 8:27 AM KARR, DAVID 
<dk0...@att.com<mailto:dk0...@att.com>> wrote:
I'm using Eclipse 2019-03 with Java 8 on Win7, with m2e installed.

I have a bunch of projects all built with Maven, that present SpringBoot REST 
services in different subdomains. All of them build fine from the command line, 
and all but one have no compile issues in Eclipse.

I just inherited responsibility for a new project which has already been 
running, but which was maintained by a separate team. All the projects were 
constructed from a template, so many things are the same as I expect. It builds 
fine from the command line with Maven, including all the unit tests.

When I import the project from my local git repo, it consistently reports that 
it can't find the "Junit" or "Mockito" artifacts, which causes compile errors 
in all of the unit tests. Those artifacts clearly show up in the effective POM, 
and in the "Maven Dependencies" tree in the Package Explorer. There are no red 
marks in the pom.xml.

I've tried "Update Project". I've tried deleting the project and reimporting.

I've looked at the entire set of compile errors, and there's nothing else 
unusual, besides not being able to find these artifacts.

I've compared this project with a similar project that doesn't have this 
symptom, including the .classpath and .project files. There are very minor 
differences, but I haven't seen any differences that seem like they might be 
significant.

I also tried deleting the imported project, then making sure that all eclipse 
dot files are removed from the repository, and reimporting.  Also no change.
_______________________________________________
m2e-users mailing list
m2e-users@eclipse.org<mailto:m2e-users@eclipse.org>
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.eclipse.org_mailman_listinfo_m2e-2Dusers&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=ZEpe6rm_yfHwS98JJS-RThjOg9KxUC7SknsLNBFFkDw&s=kuIWgxAHZWrQWGVXGZ7MrVO2-oShZeahttujnfI6Rdw&e=>
_______________________________________________
m2e-users mailing list
m2e-users@eclipse.org<mailto:m2e-users@eclipse.org>
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.eclipse.org_mailman_listinfo_m2e-2Dusers&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Y8wI83DnHF3EPmWCSV_sx-uJcvlpI-gtcBhFiew9dj0&s=nt7sExXmyReidu4T28I5KHENXNw7Gy_3E3BaSDL3hYc&e=>


--
"Have you tried turning it off and on again" - The IT Crowd
And if that fails, then 
http://goo.gl/tnBgH5<https://urldefense.proofpoint.com/v2/url?u=http-3A__goo.gl_tnBgH5&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Y8wI83DnHF3EPmWCSV_sx-uJcvlpI-gtcBhFiew9dj0&s=uKIZinM57WXVMwRGsuWsVG8kzBgLS-sy-9io_sBVpw4&e=>
_______________________________________________
m2e-users mailing list
m2e-users@eclipse.org<mailto:m2e-users@eclipse.org>
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.eclipse.org_mailman_listinfo_m2e-2Dusers&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=o4nc88lk-ZMNWwlboYJiWXz9wwoqw2yPgOc4BbfeUNg&s=ct9XtGSnKVpYitkh2KwSBgFJg-gNWPFeZ-PeSu9Q-Tk&e=>


--
"Have you tried turning it off and on again" - The IT Crowd
And if that fails, then 
http://goo.gl/tnBgH5<https://urldefense.proofpoint.com/v2/url?u=http-3A__goo.gl_tnBgH5&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=o4nc88lk-ZMNWwlboYJiWXz9wwoqw2yPgOc4BbfeUNg&s=mQRHG3LQPpnYV-GRjEv5SnsOfTxnmrwSlDjpUlnIye4&e=>
_______________________________________________
m2e-users mailing list
m2e-users@eclipse.org<mailto:m2e-users@eclipse.org>
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.eclipse.org_mailman_listinfo_m2e-2Dusers&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=xD10z7dxwzJ18WAdyXuGIP5Jy2GU5UWjnofmxeE6iAo&s=KkrbjRGBHVU5X6DSPpCM4n_Gyfl3hB7FXM3z1mjNgAM&e=>
_______________________________________________
m2e-users mailing list
m2e-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users

Reply via email to