An internal error occurred during: "Updating Maven Project - eclipse

when i convert to maven project the error is :
> An internal error occurred during: "Updating Maven Project".
> Unsupported IClasspathEntry kind=4
what's the problem?

This is all you need:
Right-click on your project, select Maven -> Disable Maven Nature.
Open you terminal, go to your project folder and do “mvn eclipse:clean”
Right click on your Project and select “Configure -> Convert into Maven Project”

Here is what worked for me:
After the steps posted in Answer 21 above (the last being Convert to Maven Project),
I did:
mvn eclipse:eclipse - this regenerates your .project and .classpath files (both of which were blown away by mvn eclipse:clean in step (2) above)
In Eclipse, I right-clicked my project(s) and then Maven > Update Project
I did not see the Unsupported IClasspathEntry kind=4 message anymore :)

As posted here, the problem is the command line eclipse project generation. So, do not use mvn eclipse:eclipse instead do:
delete your project from eclipse (without deleting it from your file system)
do mvn eclipse:clean in your command line inside your project folder
delete .classpath .project .settings in your project folder (if they still exist after doing 2.)
in eclipse import your project as an "Existing Maven Projects" and it should work flawlessly

Revert back to an earlier commit/change fixes the problem.... so it could be some corrupted project/mvn file issue, somehow. So, I followed the steps to clean up and then import the project.It worked after a couple attempts.

An internal error occurred during: "Importing Maven projects". Unsupported IClasspathEntry kind=4
Right-click on your project, select Maven -> Remove Maven Nature.
2.Open you terminal, go to your project folder and do “mvn eclipse:clean”
3.Right click on your Project and select “Configure -> Convert into Maven Project”
also delete project from eclipse. and run:
mvn eclipse:clean
then import project again.

In my case the problem was a .settings-folder commited to svn. it contained the wrong settings (in my case the jdk was set to wrong location).
So deleting .settings on svn and doing a clean checkout did it.

Following worked for me:
Right-click project, select Maven -> Remove Maven Nature.
Close Eclipse
go to project folder on command prompt and do “mvn eclipse:clean”
Start Eclipse
Right click on Project and select “Configure -> Convert into Maven Project”

I meet the same problem before when I import a project as a maven project. what I did is like is right click project and choose Maven -> Update Project... (Alt-F5) on the context menu. In the Update Maven Project dialog, ensure that "Update project configuration from pom.xml" is checked. Then press OK.
The issue should be resolved.
Another way is, you go to Problem tab, and find the Error, there is a hint saying that right click it and use Quick fix to resolve the problem.

This issue has been fixed in m2e 1.5.0 which is available for Eclipse Kepler (4.3) and Luna (4.4)
Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=374332#c14
The problem is caused by the fact that STS (the Spring IDE/Eclipse), as well Eclipse and other Eclipse based IDE's, use the m2e(clipse) plugin but that eclipse:eclipse has been probably been run on the project. When m2e encounters a "var" .classpath entry, it throws this error.
The update sites are specified at the following url: http://download.eclipse.org/technology/m2e/milestones/1.6/

Switch to terminal and type command mvn eclipse:clean
Right-click on you project, select Maven -> Update Project
Okay, everything is settled

Related

Maven Standard Directory Layout

I am trying to get the Maven standard directory layout on my Eclipse project with the expected
src/main/java
src/main/resources
src/test/java
src/test/resources
However, all I am seeing after building the project is the following:
Can someone give me some specific instructions as to what I need to do to fix this?
As I can deduce from your screen-shots
the Eclipse project is correctly configured to be a Maven project (it has the Maven nature - that can be seen by the M icon on the project folder icon)
the M2Eclipse plugin is correctly up-to-date
Now, the first error is that your POM is incorrect. You should remove the declaration <sourceDirectory>.
Then my guess is that you arrived at your current situation because, in Eclipse, you created a "Java Project" and then converted it to a "Maven Project" by right-clicking and selecting "Configure > Convert to Maven Project" (what makes me thinks that is your current source folder being src, which is the default after creating a "Java Project").
What you seem to be missing is a clean refresh of your project. You should right-click the project, go into "Maven > Update Project...", and click "OK". This should resolve your problem.
If this does not work for some reason, I suggest you remove your current project (from the workspace and the content on disk) and, instead of creating a "Java Project", create a "Maven Project", by going to "File > New... > Maven Project". The M2Eclipse plugin will kick in and this new project will be correctly configured.
Remove the <sourceDirectory> tags. You are using the defaults and these do not need to be declared.
Also, as the esteemed #Tunaki mentioned, use the M2Eclipse (m2e) plugin or right-click the project and select "Enable Dependency Management". If you are using Eclipse Luna or later, m2e is already included. If you don't do this, you'll be able to build just fine from the Command Prompt, but Eclipse will be confused.

Eclipse Maven Projects False Error

I have a parent Maven project that consists of several other projects. When i am building the project in command line everything is fine.
Then i open my Eclipse and the workspace is full of errors (which are actually false positives).
In order for me to get rid of this errors i have to do a "Run As... -> Maven install" and then a "Maven -> Update project..." on every project from within eclipse.
Is there any way or any plugin that can actually refresh the workspace and update the maven dependencies on each project, so that i can avoid this tedious operation?
Does anyone else face the same problem when using Eclipse as an IDE for his/her maven projects?
UPDATE
It seems (as in most of the cases with eclipse) that the problem was with the M2E plugin. Somehow the plugin was picking some settings in the .metadata folder in my workspace. I deleted the contents of the folder, restarted eclipse, re imported everythings and now it seems to behave as expected.
Hopefully, in newer version Eclipse will support Maven in a proper manner.
It could be that some of the files are just out of date. When I get this I do a refresh of the affected projects and then clean the workspace (Project -> Clean...) cleaning all projects.
If the refresh and clean don't do the trick, then I'd suspect that your maven settings in Eclipse point to a different set of repositories than does the command line maven's settings.xml. Go into the maven property page in Eclipse preferences and confirm that you're using the same settings.xml (re-select just to be sure).

An internal error occurred during: "Updating Maven Project". Unsupported IClasspathEntry kind=4

As the title mentioned I have the following problem: I use Eclipse with Maven Nature and when I update my Maven Project, I get this error:
An internal error occurred during: "Updating Maven Project".
Unsupported IClasspathEntry kind=4
The solution that always comes back is the following:
rightclick project, remove maven nature
mvn eclipse:clean (with project open in eclipse/STS)
(sometimes they suggest to do mvn eclipse:eclipse next)
rightclick project and reenable maven nature
Now I exhaustively tried all combinations several times. But I always keep getting the above error. The error starting occurring when I had to mvn eclipse:eclipse the project. Before it was always running fine using only m2eclipse features and setting everything in eclipse.
I had to do it slightly different to work for me:
rightclick project, remove maven nature (or in newer eclipse, "Maven->Disable Maven Nature")
mvn eclipse:clean (with project open in eclipse/STS)
delete the project in eclipse (but do not delete the sources)
Import existing Maven project
I just went to Properties -> Java Build Path -> Libraries and removed the blue entries starting with M2_REPO.
After that, I could use Maven -> Update Project again
This is all you need:
Right-click on your project, select Maven -> Remove Maven Nature.
Open you terminal, navgate to your project folder and run mvn eclipse:clean
Right click on your Project and select Configure -> Convert into Maven Project
Right click on your Project and select Maven -> Update Project
After trying all these procedures it still didn't work for me. What did work was
go into File Explorer and delete the .classpath file under the project's root folder
run Maven update within Eclipse, and check Force update of Snapshots/Releases
Our current work required integrating a number of disparate projects so unfortunately use of SNAPSHOTs in a production environment were required (taboo in Maven circles)!
This issue (https://bugs.eclipse.org/394042) is fixed in m2e 1.5.0 which is available for Eclipse Kepler and Luna from this p2 repo :
http://download.eclipse.org/technology/m2e/releases/1.5
If you also use m2e-wtp, you'll need to install m2e-wtp 1.1.0 as well :
http://download.eclipse.org/m2e-wtp/releases/luna/1.1
Slightly different option usually works for me:
"mvn eclipse:eclipse" for this project in the command line.
"Refresh/F5" this project in eclipse.
That's all, no need to re-import but need to have the terminal window handy.
I solved this by looking at this comment on JBIDE-11655 : deleting all .project, .settings and .classpath in my projects folder.
I have that problem and my solution is going source folder and run command line: mvn clean install -DskipTests eclipse:eclipse then return eclipse workspace and refresh project. Hope that help!
Your command line mvn eclipse project generator may not be the same version as that of your eclipse, and eclipse doesn't understand for your command line tool is generating.
Just use eclipse's in this case:
remove the project from eclipse (including all modules if multi-module)
run: rm -rf .settings/ .project .classpath to delete eclipse project files, also from modules
import your project as an existing maven project
I imported the project as general project from git repository.
Deleted .settings, .project and .classpath in project's folder
Configure -> Convert to Maven Project. Only this solved the problem in my case.
I removed my .classpath file in my project directory to correct this issue. No need to remove the Maven Nature from the project in Eclipse.
The specific error I was getting was: Project 'my-project-name' is missing required Java project: 'org.some.package-9.3.0 But my project wasn't dependent on org.some.package in any way.
Perhaps an old version of the project relied on it and Maven wasn't properly updating the .classpath file.
It helped in my case
rightclick project, remove maven nature
mvn eclipse:clean (with project open in eclipse/STS)
delete the project in eclipse (but do not delete the sources)
Import existing Maven project
My tricky solution is:
Open your windows Task Manager,
Find the Javaw.exe process and highlight it, then End it by End Process
In eclipse project browser, right click it and use Maven -> Update Project again.
Issue is resolved.
If you have Tomcat Server Running in Eclipse, you need to refresh project before restart Tomcat Server.

Import maven project in eclipse - folder structure not as expected

I am new to maven projects. Steps followed :
I tried importing a maven project in eclipse through File -> Import.
Gave the location of root dir of the svn checkout project. It recognized the pom.xml file.
Clicked Finish. Project imported and all files were placed in the Project Explorer of the eclipse.
Problem:
The directory structure was not as that of a java package, it was just a normal folder structure. I am not able to browse the code quickly i.e. get the declaration, different calls to a method and all the code browsing shortcuts. It gives a error says.. Project not in Build Path. On right clicking the project, there are no options present in the 'Build Path'.
Please let me know, what I am doing wrong here. How to import a maven project correctly into eclipse and set it up ?
Run :
mvn eclipse:clean
Then
mvn eclipse:eclipse
And it should be it's old self again, if not refresh the project in eclipse and that should do it
I have faced similar issue . I have resolved this issue :
Right click on project -> properties -> Project Facets -> convert it into Facet form
And you can get the folder structure as you want
I faced the same issue and could resolve by following steps
First ensure that you are able to maven clean or install. Just to ensure the proj setup works.
Right click on Project.
Navigate to Maven > Update project configuration.
This should resolve the issue. Hope this helps.
I resolved this issue with:
go to Window > Preferences > build path
under output and source folder choose the project
delete/backup original project and create/import the same.
your issue will be resolved.

eclipse project not importing the jar packages in local Maven repository

I am facing a problem in setting my eclipse project.
The problem is whenever I am creating a new project and import the code.Eclipse is not resolving the packages which are present in the jar files which are present in the C;/..../user/.m2/repository.
Hence it's giving a lot of compilation errors until I add all the required jar files manually in the build-path by going to "Add External Jars"
I saw that M2_REPO is present in my Eclipse classpath.But still it is not resolving the packages.
Please suggest how this problem can be resolved.
Gaurav
I've been having a similar error in Eclipse on OSX. In Eclipse on the Mac, there is no "Maven" entry when you right-click on a project in the explorer.
However!
I just discovered that if I right click and then click "Validate", it suddenly magically resolves all the dependencies. No idea why, but maybe this will help.
I've had this issue on Eclipse Kepler EE which comes prebuilt with m2e, I finally got it working by doing the following on each project:
Right click on the Project
Select Properties
Select Maven
Uncheck the option that says: Resolve Dependencies from Workspace projects
It should pop up with a box that says Maven setting has changed. Do you want to update project configuration. Click Yes to this.
To confirm:
Right click on the project
Select Properties
Select Java Build Path
Check the Libraries tab under Maven dependencies that all the jar you
expected are now there.
close your project, and remove your project settings files: .project, .classpath, .settings/. Then re-import this project. It will be ok.
Though this answer is late. But it can help the future audience.
You can give it a try using Project(Right-Click) -> Maven -> Update Project. To select all or the number of projects you want to update.
This worked for me.
Have you put all needed dependencies in the pom.xml? Even if the Jars are already in your local repository, each project needs its dependencies mentioned in the pom.xml to resolve the dependencies. If you do that, m2eclipse will automatically resolve the build path.
Another possibility. Are you running Eclipse using JDK or JRE - the default is JRE. You will see a warning in Eclipse console, if so.
maven eclipse plugin will not work correctly unless run with JDK.
I just had a similar problem. The JDK was there, the problems view was set to Show All, and yet there were hundreds of unresolved type errors. Not even Refresh (F5) would work.
In the Project|Properties|Java Build Path|Libraries window I was seeing only the JRE System Library, but not the desired "Maven Dependencies" entry. And "Maven Dependencies" was also missing from the Package Explorer view as well.
I finally fixed this by right clicking on the project in the Package Explorer, selecting Maven from the menu, then selecting "Update Project Configuration." This added "Maven Dependencies" and all the errors went away.
This was nice because prior to this fix I had to treat Eclipse like a dumb editor and run mvn compile on the commandline to find errors.