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

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.

Related

STS 3.6.2 Disappearing context menu items

So I upgraded to Spring Source Tool Suite 3.6.2, and I've been having a few problems. The current one is now for some projects I get incomplete context menus:
Some notes:
It's only for some projects, not all
The items that are blank vary, sometimes the full menu shows up
I've tried STS.exe -clean
I've tried deleting the .metadata folder
I've tried changing the theme
It appears to correlate with SVN projects where the Team menu item never shows up
To elaborate on the last point, all 20 or so of my projects are on SVN. For the ones where the menu seems funky (at least on the 5 or so I tested), when I could get the full menu to show up, the Team menu doesn't. This is even on a fresh STS install without SVN Connectors.
I just tested a new install of STS, and things were working fine until after restarting after an install of IvyDE. Ivy is needed for some of the projects, I haven't analyzed the correlation yet. I will try to remove that and report back.
This is also happening for two other people on my team, with brand new computers (and thus, workspaces).
It was IvyDE. Specifically the 2.2.0.final-201311091524-RELEASE version (takes breath). I'm going to try to find a version that works. My SVN stuff is not causing any problems.
Update
I've fixed my issues. I used a development build from the CI trunk build artifact site at: https://builds.apache.org/job/IvyDE-updatesite/lastSuccessfulBuild/artifact/trunk/build/
The versions included were:
Apache Ivy 2.5.0alpha_20141106222552
Apache Ivy Ant Tasks 2.5.0alpha_20141106222552
Apache IvyDE 2.3.0beta1-201409280037-hudson-296
Apache IvyDE Resolve Visualizer 2.3.0beta1-201409280037-hudson-296 (Optional)
Note that I tried just updating IvyDE to 2.5a, but still had issues. Updating Ivy fixed all my issues so far.
I filed a bug with Apache: https://issues.apache.org/jira/browse/IVYDE-377

Eclipse: web project imported from version control not finding classes from server runtime

I have a web project working in eclipse juno using tomcat 7 on one machine. I exported this project to subversion, and imported it into a fresh workspace of eclipse juno on another machine which also has tomcat 7 installed. To fix errors, I then set up the runtime "Apache Tomcat v7.0" on the second machine, and selected Projects/Clean/Clean all.
Now, my project has a list of libraries that includes "Apache Tomcat v7.0 [Apache Tomcat v7.0]", under which are listed all the jars in my tomcat installation, including servlet-api.jar, which eclipse is able to tell includes the package javax.servlet.http. However, I have hundreds of compiler errors from my source of the form "The import javax.servlet.http cannot be resolved" etc. Short of deleting and recreating the project (which might fix the second machine, but I worry that it will stop the project working on the original machine) what can I do to fix this?
Correction: the machines are running eclipse juno, not indigo as I previously stated.
If you did a refresh on the tree and a clean/build and the errors still exists, it must be the case, that they are not within the build path (check .classpath file).
So even though you may have checked it before, you should go there again and see if they are on the build path and maybe delete it and include them again.
Additionally, maybe this article about the specific problem helps.
Turns out that this is a fairly simple and annoying but otherwise harmless eclipse bug -- it seems as though the list of libraries that constitutes a particular runtime is cached when the project is loaded, and doesn't get updated if the library list changes (e.g. because the runtime didn't exist when the project was imported, but was created afterwards). Restarting eclipse causes it to reload the list, after which a project clean gets rid of the errors.

tomcat eclipse and WTP with maven

I have a maven multi-moudule project. I tried to use WTP with Eclipse 3.6 and i can't figure out how to configure my project so everything will work right with tomcat. Sometimes not all the classes are being published or/and the provided scope jar are deployed to lib dir (even though they are not supposed to). I know there are alot of sites which explain how to do it. But still i find it hard to deploy my multi module project on tomcat 6 server bundled in eclipse. Anyone has easy way? Thanks,
EDIT: I downloaded Eclipse 64bit and Maven Integration for Eclipse\WTP and then this seems ok. But still i can't understand why it doesn't work on 32bit.
look in the plugin marketplace for a free plugin called m2e-wtp. That will take care of the provided scope issues. As for classes not being deployed, the usual places I look at are the deployment assembly and/or Java Build Path. Make sure that the entries (and the dependent modules) are all there and located in the right place.

How can I execute Maven goals from Eclipse without M2Eclipse?

I am using the eclipse plugin for maven to generate eclipse projects from maven pom.xml files.
mvn -Dwtpversion=1.5 eclipse:eclipse
This works fine and, after some experimenting with several of the 400 different archetypes available, I settled on using the webapp-javaee6 archetype, which was the only one which generated a set of dependencies that were both all available and which created a project that was useable by the WTP plugin.
The problem now is that I would like to be able to invoke mvn goals from eclipse. The accepted way to do this I understand is to use the m2eclipse plugin, which I have installed.
However, after playing around a bit and getting nowhere I discovered this comment in my .project file:
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
Further searching (see this lengthy diatribe from October) suggests I'm not (just) being stupid in not being able to get this to work.
The how-to linked in the top answer to this question seems hopelessly out of date.
So, the real question - what is currently the correct way to use maven to generate a WTP-friendly project that can be converted to eclipse and then use eclipse to call the project's goals?
Have you tried File -> Import -> Check out existing Maven Projects from SCM? My understanding is that m2eclipse will then create the eclipse project for you. If the packaging defined in the pom is war, the project should be deployable with WTP. (The latter used to require an the maven-wtp-integration plugin as well, don't know whether that's still the case).
Not sure about WTP or maven archetypes, but have you come across SpringSource Tool Suite (Spring packaged eclipse) and created a Spring Roo project? You can use this to create a data driven maven built web-app in a few mins. You can even remove the spring roo bits if you don't want them, it will give you a good starting point for a web-app with very little pain.

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