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

后端 未结 2 1812
眼角桃花
眼角桃花 2020-12-28 10:35

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

相关标签:
2条回答
  • 2020-12-28 11:32

    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.

    0 讨论(0)
  • 2020-12-28 11:34

    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.

    0 讨论(0)
提交回复
热议问题