Skip to main content



      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 09:58 Go to next message
Eclipse UserFriend
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 14:47 Go to previous messageGo to next message
Eclipse UserFriend
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 08:57 Go to previous messageGo to next message
Eclipse UserFriend
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 10:29 Go to previous messageGo to next message
Eclipse UserFriend
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 10:37 Go to previous messageGo to next message
Eclipse UserFriend
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 10:38] by Moderator

Re: Import of Maven project - imports cannot be resolved. [message #1726917 is a reply to message #1726795] Thu, 17 March 2016 08:32 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 11:04:12 EDT 2025

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

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

Back to the top