0

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

Pawan
  • 31,545
  • 102
  • 256
  • 434

1 Answers1

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:

  1. Build automatically == false. enter image description here

  2. Build a multi-module Maven project, and add there 2 modules.enter image description here

  3. Insert some code into the modules. enter image description here

  4. Run mvn install inside eclipse enter image description here

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
Community
  • 1
  • 1
mliebelt
  • 15,345
  • 7
  • 55
  • 92
  • Thank you very much , i ran just the Parent POM.xml , it gave me this error , The project com.tata:tata-mw:1.0 (D:\tata\middleware\pom.xml) has 1 error [ERROR] Non-resolvable parent POM: Could not find artifact com.tata:bayer:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 9, column 12 -> [Help 2] – Pawan Sep 29 '11 at 05:43
  • I have added my structure of the directory. There seems to be a difference, your parent pom is not automatically found. But that is another story ... – mliebelt Sep 29 '11 at 06:11