Maven versus multimodule?

Very new to Maven, can someone explain to me the difference between using maven modules and just adding the dependency of your maven project to another maven project in your workspace? When will you use one over the other?

+4
source share
3 answers

A dependency is a pre-built object. You get an artifact for this dependency on Maven Central (or Nexus or the like). Commonly used dependencies for code belonging to other teams or projects. For example, suppose you need a CSV library in Android. You will pull it like an addiction.

Maven , . Maven , . , , jar.

+6

lib/jar (aka Artifact in Maven parlance), / . (, log4j).

maven , (, ). . . . http://books.sonatype.com/mvnex-book/reference/multimodule-sect-intro.html, , , - .

+2

Maven , pom parent, aggregator.

99% , Maven, - parent pom, , repositories, plugins , , dependencies.

- , , . , A requires ingredient B.

, , . :

lasagne
    <- meatSauce
        <- groundBeef
        <- tomatoPaste
    <- cheese
    <- noodles

, (meatSause, groundBeef, cheese ..) , .

, pom, , modules:

<modules>
    <module>meatSauce</module>
    <module>groundBeef</module>
    <module>tomatoPaste</module>
    <module>cheese</module>
    <module>noodles</module>
</modules>

, 5 :

groundBeef -> tomatoPaste -> cheese -> noodles -> meatSauce

( " " ) , (, meatSauce tomatoPaste).

: module, - , .

, Jenkins, Eclipse , (, groundBeef meatSauce).

, Jenkins Eclipse,

+1

All Articles