问题
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.
回答1:
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
Go to menu
Window--->Preferences
.At the
Preferences window
, selectMaven---->Archetypes
,On the
Right Panel
, clickAdd Remote Catalog...
button.At the
Remote Archetype Catalog windows
enter the following: -Catalog file
: http://repo.maven.apache.org/maven2Description
Maven Central
Add more remote catalog.
Catalog file
: http://download.java.net/maven/2Description
Java.Net
Click
OK
to apply change.
Create the parent project
- Go to menu
File ---> New ---> Other
. - At the
Select Wizard Windows
, selectMaven ---> Project
. - Click next and enter the required information so that we are at the
New Maven Project
. - At the
Filter
textbox, enterpom
- Choose
org.codehaus.mojo.archetypes:pom-root:1.1
- Click next and enter the required information so that the parent creation is finished.
Create the child project
- Right click at the parent project and select
New ---> Other
. - At the
Select Wizard Windows
, selectMaven ---> Project
.
- At the
- Click next and enter the required information so that we are at the
New Maven Project
. - You will see that the
Parent Project
=MY PARENT
- Enter the
Module name
, e.g. my-ear, my-ejb or my-web. Then clickNext
button, - At the
Filter
textbox, enter some of the followingorg.codehaus.mojo.archetypes:webapp-javaee6:1.5
org.codehaus.mojo.archetypes:ejb-javaee6:1.5
org.codehaus.mojo.archetypes:ear-javaee6:1.5
- 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.
回答2:
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.
来源:https://stackoverflow.com/questions/15683299/how-do-i-configure-a-java-ee-maven-project-in-eclipse