Maven projects import does not work well - eclipse

This is a weird problem and probably, It has a stupid solution, but still.
I have recently install a windows 32 bit machine on a VBOX (runs originally on linux). I don't know if it is important but maybe.
I installed a fresh eclipse Juno with m2e and m2e-wtp.
I checked out a maven project (multi module) from SVN and then i tried to Import it as maven project to eclipse, simply by right clicking --> import --> maven --> existing maven project.
I have done this millions time with no problems till now.
Eclipse imports all the projects but they all have this error:
Project build error: Non-resolvable parent POM: Could not find artifact com.xx.xx:parent-pom:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM.
Also, when I right click a java project, and check it's properties it seems that eclipse does not recognize it as a java project (I added a screenshot).
I wish to state that I am the only one here to have this problem, so I assume this is an eclipse problem.
Please help.
Regards,
Idob

Are you sure, that the parent-pom is available in the correct version?
The error message tells you that the parent-pom is not available.
Either it has to be available as an eclipse project, or it has to be available at your repository. You can find your local repository in WinXP machine by default at Documents and Settings\.m2\repository.

Related

Regarding Maven

I am new to Maven and if you feel i am asking really basic question then please forgive me.
I am facing couple of problems with Maven mentioned below.
I am using Eclipse Luna 4.4.1 (Which comes with the Maven Plugin).Now i installed two plugins..out of which one is for subclipse(with SVNKit) and m2e-Subclipse which is used for integrating the maven with SVN.I downloaded the project in eclipse using svn plugin as "checkout as Maven project" and i could see the project being downloaded and now to remove all the errors related with the POM.XML i downloaded the Maven and given the local path of the Maven in the preferences > Maven > installations and changed the Global Settings and user settings files which are project specific.
1). Now even after doing all this circus i still can not see the Maven build options in my Eclipse.
2). I am not even able to clean the project from command prompt.
when i go to my project directory and type "mvn -version" which shows me the correct version of maven.
But when i try to clean it using mvn clean. it does not work.
Please help.
Regards.

How to fix error "Updating Maven Project". Unsupported IClasspathEntry kind=4?

I have imported maven project in STS, when I run update update project I receive:
"Updating Maven Project". Unsupported IClasspathEntry kind=4
Is there a workaround for this?
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://eclipse.org/m2e/m2e-downloads.html
If you can't use m2e 1.5.0 for any reason, then :
Disable the maven nature for the project (via the right-click menu)
Run mvn eclipse:clean (while your project is open in STS/eclipse). Depending on the timing, you might need to do a refresh or two on the project before re-enabling the maven nature. You should be able to see that your project has lost it's Maven nature. (The eclipse:clean goal just deletes the .project, .classpath and .settings/ files/directories. You can also just remove those files (again while the project is open) instead of running mvn eclipse:clean.)
Re-enable the maven nature.
(Most of the time, this can be done by right-clicking on the project in question in the package explorer pane, and then choosing 'Configure'-> 'Convert to Maven Project')
Right-click on your project, select Maven -> Remove 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”
Now you got “Unsupported IClasspathEntry kind=4 Eclipse Scala” disappear.
Sometimes, even re-importing the Maven project will not work. Updating the project correctly in eclipse is not a deterministic process.
The only 100% fail safe procedure I've found is:
Disable Maven Nature, run mvn eclipse:clean, restart, cross your fingers and Pray 3 times.
If this won't work, delete the project, run mvn eclipse:clean, re-import refresh, pray and use the force.
If this still doesn't work, restart Eclipse, or even better your computer. While waiting for the reboot, you can make a random donation to fix your Karma. Repeat step 2 and don't forget to pray and control your anger. Anger leads to hate. Hate leads to suffering.
Try all the other answers posted in this thread. You might need to try them all for 3 times at least before giving up.
Format your Computer, re-install Eclipse and Maven. No need to pray anymore, all gods hate you anyway
Delete your git project, burn the physical drive that stored the remote repository, and write your project from scratch.
Find a time machine, travel to the past and convince yourself to follow another, non-programming career or at least to avoid Java
Make sure that the version of the m2e(clipse) plugin that you're running is at least 1.1.0
Close maven project - right click "Close Project"
Manualy remove all classpathentry with kind="var" in .classpath file
Open project
or
Remove maven project
Manualy rmeove .classpath
4 Reimport project
Have you tried:
If you have import project into the eclipse 4, please delete it.
In maven consol, run: mvn eclipse:clean
In Eclipse 4: File -> Import -> Maven -> Existing Maven Projects
Seeing all other answers. I found for me a simpler way.
I just removed all lines in the .classpath (editing with eclipse) containing a var and used maven -> update project without an error.
This error is also thrown if the update command is used on a project instrumented for code coverage with Clover.
To resolve in this scenario:
Un-instrument the project folders you wish to update.
Run the maven update then instrument for code coverage again.
I tried Marco's steps but no luck. Instead if you just get the latest m2e plugin from the link he provides and one by one right click on each project -> Maven -> Update Dependencies the error still pops up but the issue is resolved. That is to say the warnings disappear in the Markers view. I encountered this issue after importing some projects into SpringSource Tool Suite (STS). When I returned to my Eclipse Juno installation the warnings were displaying. Seeing that I had m2e 1.1 already installed I tried Marco's steps to no avail. Getting the latest version fixed it however.
I couldn't get mvn eclipse:clean etc to work with Kepler.
However I changed creating and extending variables to just using external jars in my eclipse classpath. This was reflected in no var's in my .classpath.
This corrected the problem. I was able to do a Maven update.
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
Upgrading from Kepler to Luna worked for me.
I had just added some components for Java 1.8 support. It seems that they where not as compatible as I would like or that I mixed the wrong ones. It really caused a lot of problems. Trying to update the system reported errors as they couldn't fulfill some dependencies. Maven upgrades didn't work. Tried a lot of things.
So, if there is no reason to avoid the upgrade just add the luna repository to avalilable software sites (Luna http://download.eclipse.org/releases/luna/ ) and "check for updates". It is better to have all the components with the same version and there are some nice new features.
I tried all the steps mentioned here and on similar questions but couldn't solve this problem. I could neither solve problem nor update my m2eclipse. So I installed Eclipse Luna and it solved my problem... though it mean that I had to spend about 45 min to configure all the environment in my workspace.
Try
mvn clean install eclipse:eclipse -Dwtpversion=2.0 command on DOS command prompt.
Suggesting you because , It worked for me!!
I'm using Eclipse 4.3.2 (Kepler) with M2E 1.4.x and felt over this problem several times!
In my case the "mvn eclipse:eclipse" command also generates Checkstyle, PMD and Findbugs configuration so "mvn eclipse:clean" does not help me because it drops all those config files again.
The best solution for me was to delete all ".classpath" files:
find . -name ".classpath" -delete
and import the project into eclipse afterwards.
Before importing the project, it should be converted into eclipse project
mvn eclipse: eclipse
Then i found the following error.
An internal error occurred during: "Importing Maven projects".Unsupported IClasspathEntry kind=4
Where is the value kind = "var" that M2E does not recognize and therefore throws the error.
Now type this.
mvn eclipse: clean
Now refresh the project in eclipse or re-import.

Eclipse stopped deploying any of the project's [maven] dependencies to tomcat

I'm having this problem for a while now. I tried so many things that failed that I had to switch to netbeans in order to be able to develop. But netbeans lacks some important features, so I really need this to work in eclipse.
From scratch:
I have a "parent" maven project with several modules in our svn repo. 2 of the modules are web projects that I need to deploy in a tomcat server. These web projects have several dependencies, among them are the other modules of the parent maven project.
I had this configuration running with eclipse ganymede, but 3 weeks ago I started to get ClassNotFoundExceptions while starting the server, I have no clue why this started happening.
Since then I've tried to get new Eclipse (Java EE) packages, but no matter how I do it, this is what happens:
I get eclipse with maven+svn running and add my tomcat installation to eclipse's server list.
I check out the parent project, this includes the modules. Eclipse gives me a whole list of projects.
The crap starts: I cannot add the 2 web projects to the tomcat, it tells me no projects can be added (meaning "you dont have any web projects!"). Also, I cannot choose "Run as -> Run on Server" on Servlet classes ("Selection did not contain any resources that can run on a server"), even though they clearly extend HttpServlet. Since I spent way too many hours into this, I found out how to deal with this: Convert the project into a "Faceted Project" in the project's properties.
Now I can add both projects to the tomcat server
When starting the server, i get
FATAL: Error loading WebappClassLoader
context: /BEWeb
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader#55ae3b4d
de.comp.utils.servlet.SInvokerServlet
This class is in one of the modules that are listed as a dependency
WEB-INF/lib of the deployed project ist empty. No libs at all, maven and/or eclipse doesn't do what it did 3 weeks ago.
I tried messing around with the eclipse files in .settings and also with .project and .classpath, but nothing useful turned out.
Can someone point me in the right direction? I'll do everything from scratch if you need me to, it would not make a difference as I did this a lot of times already (with different versions of eclipse, maven, tomcat, ...)
If you need me to post any files, I'll be happy to comply.
Since this kept me awake at nights for quite some time now, I'll put a bounty on this one.
thx so far.
================================
EDIT in order to answer the upcoming questions
Just to check: building your projects from the command line and deploying them by hand does work, right?
Yes, mvn package works fine, copying that .war file to tomcat results in a working application, also the war file contains all dependencies.
When you say "get new Eclipse (Java EE) packages", do you mean you are now using Eclipse Indigo (3.7)?
Yes. But I had the same problems with 3.5, the eclipse versions didn't show any difference in their behavior.
When you say "I get eclipse with maven+svn running", are you using m2eclipse or have you generated eclipse configuration using maven eclipse plugin?
I have m2e installed and checked out the projects from svn using "Right click -> Checkout as Maven Project". There are no eclipse-specific files in the repository though, it seems they are being generated upon checkout.
When I use mvn eclipse:eclipse, then close+reopen the projects, I cannot add them to the tomcat server ("There are no resources that can be added or removed from the server"), meaning that eclipse does not recognize them as web projects.
First of all: do not use the maven-eclipse-plugin together with m2e/m2eclipse, the two are not compatible. m2e should be able to import your Maven projects and set them up as Eclipse expects.
Did you install the WTP add-on for m2e? This blog post may be worth reading.
If any of your pom.xml files invokes any specific plugin (e.g. for code generation) you may need a corresponding m2e add-on. This wiki post may give you an idea of why.
Another attempt you might consider is setting up a Helios based environment. Check that all the plugins you might need are still available, though.

Problem installing Maven plugin (m2eclipse) in Eclipse (Galileo)

I have Eclipse Galileo (for Java EE Developers) installed, and I'm now trying to get the m2eclipse Maven plugin installed as well.
I follow the basic steps described at http://m2eclipse.sonatype.org/installing-m2eclipse.html, and it seems to be installing just fine. However, after restarting Eclipse after the install it doesn't seem to be anywhere. I should for instance have the ability to create a new maven project, but when the new-project wizard opens, there is no folder for Maven (I also cannot find any reference to it in the context menus of the existing projects I have).
When I click at Help > About Eclipse > Installation Details, I find "Maven Integration for Eclipse (Required)" in the tab "Installed Software", yet another thing pointing towards a successful installation (but I can't find it under the "Plug-ins" tab, should it be there too?)...
I feel like I'm just missing something very obvious, but right now I just don't see it...
I managed to find the answer to this myself:
I had put the Eclipse installation folder under c:\Program Files\, but when I moved it directly under c:\ instead, the plug-in installation worked just as it should. I assume that is because Eclipse wasn't allowed to write to its own installation folder (but I didn't get the usual question from Windows that something was trying to access Program Files either...).
In one way I feel like I should be a bit ashamed that I didn't think of this before. On the other hand though, there could have been some reasonable error message stating that something failed during the plug-in installation...
Well, I hope this at least helps somebody else as well :)
Did you check the m2eclipse installation requirements?
In particular, you need WTP.
"Maven integration for Eclipse" (core feature) and optional "Maven POM Editor" feature depend on the "Eclipse XML Editors and Tools" feature from WST
"Maven integration for WTP" feature provides Maven project configuration for WTP
Did you have a previous version of m2eclipse installed? Did you uninstall it before to install the latest version? Just in case, does the following note applies to you?
Note about 0.9.8 Workspace Incompatibility: If you are using
m2eclipse 0.10.0 with a workspace that
contains projects created under
m2eclipse 0.9.8, you must remove the
workspaceState.ser file. The
workspaceState.ser file is located
within the workspace directory in
$workspacedir/.metadata/.plugins/org.maven.ide.eclipse/workspaceState.ser.
If you remove this file, m2eclipse
0.10.0 will regenerate it as needed.
In my case, uninstalling the previous m2eclipse version didn't work and I had to start with a fresh Eclipse install (maybe try this also).
Regarding the plugin tab, this is what I have (to confirm that you should definitely find something):
alt text http://www.imagebanana.com/img/84h6mw8z/screenshot_008.png
Note that I also installed some extras from m2eclipse Extras Update Site: http://m2eclipse.sonatype.org/sites/m2e-extras
I was able to solve this problem by going into Program Files, right click on the eclipse.exe file and select "Run as administrator". When I restarted Eclipse it said I had no plugins installs so I reinstalled and my problems were solved.
PROBLEM SOLVED
I had this same problem and I used the following software site:
["M2Eclipse - http://download.eclipse.org/technology/m2e/releases/1.0] (without square brackets) to download the M2Eclipse plugin in Eclipse 3.7.0 (Indigo). For more information refer this.
To solve the problem of 'not getting Maven plugin running in eclipse' , it can be solved by altering admin rights to the .m2 folder . Right click on .m2 folder and go to network sharing. give all rights to all users. Restart eclipse and maven options will start to appear in Eclipse.

m2eclipse and Eclipse WTP

I have a very large workspace with about 30 projects all together. I am using Eclipse 3.5 with m2eclipse. I check out of my subversion repository using the defaults in order to import the projects into my workspace.
I create a Tomcat server instance, and publish my web project to the tomcat server. Sounds easy enough.
The problem is that it does not appear as though the transitive dependencies for my other projects are being automatically added to the container, so when the container starts up I get classnotfound exceptions, etc.
I go into the web project's properties, and I notice that the Java EE Module Dependencies are NOT checked for some of the transitive dependencies. I check them, and everything seemingly works until I do a project clean build, when the Java EE Module Dependencies are automatically reset by eclipse, so I need to recheck them. This is maddening, and I was hoping there was some way to automatically pull in all of the transitive dependencies when working with Eclipse WTP.
I should mention, using standard maven build works just fine, and everything gets pulled in appropriately into the resulting WAR file. It just doesn't work so good with WTP for some reason.
You need to make sure that you have "Maven integration for WTP" feature from m2eclipse installed. There is a simple tutorial available at http://docs.sonatype.org/display/M2ECLIPSE/WTP+mini+howto
What version of WTP and m2eclipse you are using? Check that dependency version declared in project's pom.xml matches with version declared in workspace project and make sure that workspace dependency resolution is enabled.
Also, you can try to run "Maven / Update project configuration" from the project popup menu and check that there is no errors on Maven console and in Eclipse's own log.
If the above won't help, try to reproduce issue on a smaller project and then submit it with a bug report
It appears as though the latest version of m2eclipse (.99x) solves all of my issues.
If you are tempted to use m2eclipse wtp extras you need to be aware that they are not supported by Sonatype and, although mostly OK, are not 100% robust.
See http://maven.40175.n5.nabble.com/What-is-the-recommended-alternative-to-m2eclipse-extras-WTP-integration-td135727.html