Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Import of Maven project - imports cannot be resolved.(Intellij Maven project import into Eclipse - maven build works but Java exlplorer has unresolved import refs (red X on folders/files))
Import of Maven project - imports cannot be resolved. [message #1726342] Fri, 11 March 2016 14:58 Go to next message
BARB Switzer is currently offline BARB SwitzerFriend
Messages: 4
Registered: March 2016
Junior Member
MAVEN project was created with Intellij (Java).

I imported the Project into Eclipse MARS. I can right click on the main pom.xml and Run a Maven build (clean compile) and
build finishes successfully. I am using JDK 1.7

But the Java Explorer view will have all my folders marked with a RED X indicating imports cannot be resolved.

I defined the path in MAVEN user settings
Local Respository: C:\Users\u6025245\.m2\repository
User Settings: C:\Users\u6025245\.m2\Settings.xml

Java -> BUild Path -> Class Path Variables does contain M2_REPO which points to my local .m2/respoitory

Anyone know the secret to fixing this issue in Eclipse?
Re: Import of Maven project - imports cannot be resolved. [message #1726362 is a reply to message #1726342] Fri, 11 March 2016 19:47 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 03/11/2016 08:56 AM, BARB Switzer wrote:
> MAVEN project was created with Intellij (Java).
>
> I imported the Project into Eclipse MARS. I can right click on the
> main pom.xml and Run a Maven build (clean compile) and
> build finishes successfully. I am using JDK 1.7
>
> But the Java Explorer view will have all my folders marked with a RED X
> indicating imports cannot be resolved.
>
> I defined the path in MAVEN user settings
> Local Respository: C:\Users\u6025245\.m2\repository
> User Settings: C:\Users\u6025245\.m2\Settings.xml
>
> Java -> BUild Path -> Class Path Variables does contain M2_REPO which
> points to my local .m2/respoitory
> Anyone know the secret to fixing this issue in Eclipse?

Did you use Maven from the command line inside the project root
directory thus:

$ mvn eclipse:eclipse

?

This has always worked for me.
Re: Import of Maven project - imports cannot be resolved. [message #1726777 is a reply to message #1726362] Wed, 16 March 2016 12:57 Go to previous messageGo to next message
BARB Switzer is currently offline BARB SwitzerFriend
Messages: 4
Registered: March 2016
Junior Member
Someone on my team suggested we import as a Java project then manually setup M2_REPO in the classpath. This in fact did bring the jars into Referenced Libraries but Eclipse still could not resolve, I did run eclipse:eclipse clean etc with no luck.

I started over with a new workspace and this time imported as a MAVEN project using the built in M2e feature. This then brought all the jars into the workspace as Maven Dependencies.

So problem solved. Thanks for your suggestion!
Re: Import of Maven project - imports cannot be resolved. [message #1726793 is a reply to message #1726777] Wed, 16 March 2016 14:29 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 03/16/2016 06:57 AM, BARB Switzer wrote:
> Someone on my team suggested we import as a Java project then manually
> setup M2_REPO in the classpath. This in fact did bring the jars into
> Referenced Libraries but Eclipse still could not resolve, I did run
> eclipse:eclipse clean etc with no luck.
>
> I started over with a new workspace and this time imported as a MAVEN
> project using the built in M2e feature. This then brought all the jars
> into the workspace as Maven Dependencies.
> So problem solved. Thanks for your suggestion!

It would probably work if you do it BEFORE all the other effort you
tried. Again, it always has for me. Maybe for future projects you might
give it a try. (If it's convenient.)

Glad you're running now.
Re: Import of Maven project - imports cannot be resolved. [message #1726795 is a reply to message #1726793] Wed, 16 March 2016 14:37 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Better to let m2e do the work, as it's a plug-in written by Eclipse-knowledgeable people specifically for integrating with Eclipse. The eclipse:eclipse target is Maven trying to do IDE things, which are generally outside it's area of expertise.

[Updated on: Wed, 16 March 2016 14:38]

Report message to a moderator

Re: Import of Maven project - imports cannot be resolved. [message #1726917 is a reply to message #1726795] Thu, 17 March 2016 12:32 Go to previous message
Lisa22 Patterson is currently offline Lisa22 PattersonFriend
Messages: 1
Registered: March 2016
Junior Member
Im glad to see the problem is resolved. Thanks for informing.
Previous Topic:Looking for similar features available in Visual Studio in Eclipse
Next Topic:Python PyDev Virtualenvwrapper
Goto Forum:
  


Current Time: Fri Mar 29 04:59:28 GMT 2024

Powered by FUDForum. Page generated in 0.04470 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top