When running my WebApp project from Eclipse most of times it run correctly. But if by mistake to stop server, I kill it in \"Console\" view on instead of \"Stop\" Server from \"
This problem might be caused by your local project being out of sync with your code repository. I would suggest to refresh/synchronize your project.
Dont do those crazy cosmic workarounds !!
This works fine:
Add to your ".project" file (hidden) these lines:
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
Enjoy !
Why? if you check that unexisting directory, well, that "../.metadata/blah/blah/tmp0/wtpwebapps/YOURPROJECT/"
is EMPTY: then your build aint creating the WAR... !!!
Because maven plugin isnt understanding HE HAVE TO !
I found this after comparing two .project files from both different deploying/non-deploying projects...
Hope helped !
Check Tomcat doc for Document base xyz does not exist or is not a readable directory:
Document base does not exist or is not a readable directory The URL specified by the war parameter must identify a directory on this server that contains the "unpacked" version of a web application, or the absolute URL of a web application archive (WAR) file that contains this application. Correct the value specified by the war parameter.
Can you manually do "Clean..." and then "Publish" (from context menu on Tomcat in Servers view) after clean project is completed?
In my case it was enough to copy (from working project):
I had a hard time to make it work, but thanks to "Alexander Pogrebnyak" (see deploying a war file in WTP(Eclipse) tomcat server) I was able to make Eclipse Web Projects work with Maven through m2e:
Before starting, I must say that I'm a very suspicious man, so I always start by cleaning all my projects using "Eclipse > Project > Clean..." menu (without "start a build immediately" option checked). I also do not have "Eclipse > Project > Build Automatically" option checked.
By the way, I suppose that you will have your m2e plugin installed already, or what I'm going to state has no meaning...
Well, let's start:
First, bye bye Server configuration:
1) If your have any project in a previous server configuration, remove it (right click on the server and select "Add and remove" option)
2) Clean your server work directory (right click on the server and select "Tomcat Server Work Directory")
3) Clean the compiled "leftovers" (right click on the server and select "Clean")
4) Remove your server configuration from the "Servers" tab
5) Completely delete your "Servers" project/folder (shown in your "Project Explorer" tab)
6) BONUS: I also remove my server runtime environment ("Eclipse > Window > Preferences > Server > Runtime Environments")
Second, "Maven clean" (if your web project has a "Maven nature"):
1) Right click your web project
2) "Pop up Menu > Run As > Maven clean"
This should wipe out your target folder
Third, Instal m2e WTP integration (yeah! It does not come as "default". One whole day to figure it out):
1) Open Maven "Discovery" option (Eclipse > Windows > Preferences > Maven > Discovery)
2) Press "Open Catalog" Button (a "m2e Marketplace" window should appear)
3) Scroll down until you find the "WTP Integration" option, then "check" it!
4) Press "Finish"
5) A "plugin screen like" will appear. "Next", "Next", "Agree", blah, blah, blah...
Fourth, leave Eclipse than run it again:
1) If not asked to restar Eclipse (that I find hard to believe you won't), restart it yourself!
Fifth, maven reintegration:
1) Add Maven nature to the project (Right click your web project, "Pop up Menu > Configure > Convert to Maven Project")
2) Update your maven configuration (Yeah, yeah, suspicious, I know). Right click your web project again, now with a "M" on its icon ("Pop up Menu > Maven > Update Project")
3) Run a maven install (Right click your web project, "Pop up Menu > Run As > Maven install")
4) Build your project ("Eclipse > Project > Build All")
Sixth, put it all to work:
1) Deploy and run your web application (Right click your web project, "Pop up Menu > Run As > Run on Server")
2) You will be asked to create another server configuration. It will create the "Servers" project/folder again, but that's the way it is.
That's it!!! I gotta admit, once I ran the server, it didn't work, but this time (i dunnot know why) "Log4J" libraries could not be found. After one "project clean" + "maven clean" and one "maven install" + "project build" another message stating that my Servlet class could not be found. Once again, I executed a "project clean" + "maven clean" and a "maven install" + "project build" and "voila"!!! It worked (And that's why I'm so suspicious).
I was starting to get worried with this new Juno + m2e double... Never had this kind of problem with Indigo or Ganymede... But I guess I can trust Eclipse again (can I?)
I have deleted the "problem folder" .metadata.plugins\org.eclipse.wst.server.core\tmp0\ and it works now :)