Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Importing existing Maven Web Apps/Services in Eclipse 4.2 (Juno)...

Is there something that explains how to configure a clean installation of Eclipse (4.2/Juno) to enable Maven features to recognize, build, deploy and debug an existing maven web application or service?  I've looked through http://wiki.eclipse.org/M2E  and related pages but I couldn't find a complete explanation of the process.

I downloaded the latest 4.2.0 Juno J2EE installer (eclipse-jee-juno-installer-windows.exe) from Genuitec and installed the 64-bit version.

I then pulled all updates and have installed the following as listed in the "Software and Workspace Center" view:
  • TestNG (6.7.0)
  • Maven Integration (m2e) (2 related) (1.1.0)
  • Microsoft Visual Studio Team Foundation Server plug-in for Eclipse (11.0.0)
  • Eclipse EGit (2.1.0)
  • EGit Plug-in Import Support (2.1.0)
  • EGIT Mylyn (2.1.0)
  • EGIT Project Set Support (2.1.0)
  • Eclipse Java Web Development Core (3.4.1)
  • Eclipse Java Web Developer Tools (3.4.1)
  • Eclipse Java Web Developer Tools User Documentation (3.4.1)
  • Web Page Editor (2.3.8)
  • JAX-WS DOM Tools (1.0.200)
  • JAX-WS Tools (1.2.0)
  • m2e - Maven Integration for Eclipse (1.2.0)
  • m2e - slf4j over logback logging (Optional) (1.2.0)
  • Subclipse 1.8.x (5 related) (1.8.16)
  • Mylyn Versions Connector: Git (1.0.1)
  • _javascript_ Development Tools (1.4.1)
  • WST Web Core (3.4.1)
  • Eclipse Web Developer Tools (3.4.1)
  • WST Web User Documentation (3.3.0)
  • WST Web Services Core (3.4.0)
  • Web Services Tools (3.4.1)
  • WST Web Services User Documentation (3.4.1)
I deleted all existing source folders, then used the Microsoft Team Explorer Everywhere plugin to get latest application source.

Next, I go to Import->Maven->"Existing Maven Projects".  The project shows up, but doesn't appear to be recognized as a web application.  I right click, go to Debug As-> or Run As-> but there is no Run on server option.

I then go to <Project>->Properties->Project Facets->Convert to Faceted form... (should I really have to do this manually?) and select the following:
  • Dynamic Web Module (v2.5)
    • Click "Further configuration available..."
      • change content directory from "WebContent" to src/main/webapp (Maven 'convention' but not what m2e/Eclipse seems to want -- see below)
      • UNCHECK Generate web.xml deployment descriptor (Already exists in my project)
  • Change Java from v1.7 to v1.6
  • Click OK
Now I see a "JAX-WS Web Services" node in the project, even though it isn't a JAX-WS Web service (not sure if that means anything) but I can now initiate a "Run On Server" or "Debug On Server" from the menus...yay!

However, doing "Run as->Run On Server" and selecting my Tomcat 6 server seems to deploy, but nothing happens...boo!  It didn't even say it was starting the application even though it deployed according to tomcat.

After a few more hours of searching, someone listed an example with the "Content directory" as "target/<webappfolder>", presumably where the assembled web app is located after a build.

That seemed to work.  However, my Maven project builds the war and names the "target/<webappfolder>" with the Maven version as part of the folder name (e.g., WebApp-1.0.1-SNAPSHOT) so if I release and/or change the version, it breaks and I can't find a way to change this folder location once it is set!!!  Shouldn't the "content directory" be dynamic based on the POM?

Questions:
  1. Am I doing this right?
  2. Why doesn't m2e (or eclipse?) infer the src and/or target information it needs from the POM and content instead of me having to hold it's hand?
  3. Can I change the "content directory" after it is set the first time?  If so, how?
  4. Does it really have to be this hard to import an existing maven project?
Thanks!

-- 
Jeff Vincent
predatorvi@xxxxxxxxx
See my LinkedIn profile at:
http://www.linkedin.com/in/rjeffreyvincent
I ♥ DropBox !! 


Back to the top