Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure a Java EE maven project in Eclipse?

I know Maven pretty well, but I usually work with Netbeans, which makes it quite easy to deploy Java EE applications - and handle hot deployment of any changes.

The team I work with now uses Eclipse as their IDE of choice, but none of them has worked with Maven projects before; so I need to know how to correctly add Eclipse's project facets to the maven projects we have, in order to support (hot) deployment through WTP. We are using Weblogic 12c for this particular endeavour.

Our project layout is as simple as it gets:

super-project (pom)
    project-ear (pom)
    project-ejb (pom)
    project-web (pom)

Thanks for any resource you can point me to.

like image 371
javabeats Avatar asked Mar 28 '13 13:03

javabeats


People also ask

Does Eclipse support Java EE?

Package Description. Tools for Java developers creating Java EE and Web applications, including a Java IDE, tools for Java EE, JPA, JSF, Mylyn, EGit and others.


2 Answers

I suppose that you've installed all required plugins to the Eclipse already. As @Michał Politowski mentions, M2E, M2E-WTP and so on.

Add Archetype Catalog

  1. Go to menu Window--->Preferences.

  2. At the Preferences window, select Maven---->Archetypes,

  3. On the Right Panel, click Add Remote Catalog... button.

  4. At the Remote Archetype Catalog windows enter the following: -

    1. Catalog file: http://repo.maven.apache.org/maven2
    2. Description Maven Central
  5. Add more remote catalog.

    1. Catalog file: http://download.java.net/maven/2
    2. Description Java.Net
  6. Click OK to apply change.

Create the parent project

  1. Go to menu File ---> New ---> Other.
  2. At the Select Wizard Windows, select Maven ---> Project.
  3. Click next and enter the required information so that we are at the New Maven Project.
  4. At the Filter textbox, enter pom
  5. Choose org.codehaus.mojo.archetypes:pom-root:1.1
  6. Click next and enter the required information so that the parent creation is finished.

Create the child project

  1. Right click at the parent project and select New ---> Other.
    1. At the Select Wizard Windows, select Maven ---> Project.
  2. Click next and enter the required information so that we are at the New Maven Project.
  3. You will see that the Parent Project = MY PARENT
  4. Enter the Module name, e.g. my-ear, my-ejb or my-web. Then click Next button,
  5. At the Filter textbox, enter some of the following
    1. org.codehaus.mojo.archetypes:webapp-javaee6:1.5
    2. org.codehaus.mojo.archetypes:ejb-javaee6:1.5
    3. org.codehaus.mojo.archetypes:ear-javaee6:1.5
  6. Click next and enter the required information so that the child creation is finished.

Summary

I've used both NetBeans 7.x and Eclipse Juno together. When I move to Eclipse I've face the issue as same as your. Then I've captured the steps above from NetBeans logs one by one, and do the same thing manually by using Eclipse.

I hope this may help.

like image 200
Charlee Chitsuk Avatar answered Oct 20 '22 18:10

Charlee Chitsuk


I would make one small change:

Create the child project

Right click at the parent project and select New ---> Other.
    At the Select Wizard Windows, select Maven ---> **Maven Module**

This way it will automatically recognize this as a child project of the parent.

like image 36
Ari Avatar answered Oct 20 '22 17:10

Ari