问题
I am working on existing Maven Project Which has got 5 modules like
<modules>
<module>sideware</module>
<module>xmlmodule</module>
<module>business</module>
<module>service</module>
<module>helper</module>
</modules>
Each Module has got a one POM.xml file as well as
and one main Pom.xml
I am using Eclipse to run the POM.xml files as Maven install
Please tell me do i need to run the Each POM.xml indivudally ??
Or can i run the Parent POM.xml file once ??
Thank you
回答1:
I think it is sufficient to run the parent POM. See the question What is the "reactor" in Maven? about the plugin that implements that for Maven. So you have the following options (at least):
- Build the parent POM, which will build all modules as well.
- Build a module individually, and it will build its dependencies automatically.
Here is a small experiment I have done on my own:
Build automatically == false.
Build a multi-module Maven project, and add there 2 modules.
Insert some code into the modules.
Run
mvn install
inside eclipse
As a result, I get the following output in the console:
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] MultiModuleExample
[INFO] Unnamed - com.tsi.mli:sideware:jar:0.0.1-SNAPSHOT
[INFO] Unnamed - com.tsi.mli:business:jar:0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Building MultiModuleExample
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [site:attach-descriptor {execution: default-attach-descriptor}]
[INFO] [install:install {execution: default-install}]
[INFO] Installing C:\projekte\setools-work\build\example-build-projekte\indigo-full\ws\multi-module-example\pom.xml to C:\Users\mliebelt\.m2\repository\com\tsi\mli\multi-module-example\0.0.1-SNAPSHOT\multi-module-example-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.tsi.mli:sideware:jar:0.0.1-SNAPSHOT
[INFO] task-segment: [install]
...
The directory structure I have got is:
multi-module-example/
business/
src/
target/
.classpath
.project
pom.xml
sideware/
...
src/
.project
pom.xml
来源:https://stackoverflow.com/questions/7592857/maven-application-got-5-modules-and-6-pom-xml-files