Search code examples
javamavenjava-moneyjsr354

Why the JavaMoney dependency is packages as POM?


I am not very much experienced with build systems, but this got me curious.

Most libraries use <type>jar</type> (the default) for their dependencies, but the JavaMoney library uses pom instead, what's the reason?


Solution

  • Cause JavaMoney is multi module project and root of this projects has packaging pom.

    When you declare dependency in pom.xml it will be attached to project with their transitive dependencies. This also work for artifacts with packaging pom. In this case transitive dependencies will be implementation of JavaMoney.

    mvn dependency:tree
    ...
    [INFO] +- org.javamoney:moneta:pom:1.3:compile
    [INFO] |  +- org.javamoney.moneta:moneta-core:jar:1.3:compile
    [INFO] |  +- org.javamoney.moneta:moneta-convert:jar:1.3:compile
    [INFO] |  +- org.javamoney.moneta:moneta-convert-imf:jar:1.3:compile
    [INFO] |  +- org.javamoney.moneta:moneta-convert-ecb:jar:1.3:compile
    [INFO] |  +- javax.money:money-api:jar:1.0.3:compile
    [INFO] |  \- javax.annotation:javax.annotation-api:jar:1.3.2:compile