Maven dependencies - Location of dependent jars

Discussions

General J2EE: Maven dependencies - Location of dependent jars

  1. My project structure is as below

    Project
       |-Project.xml and maven.xml
       |-Client
           |-Project.xml
       |-Server
           |-Project.xml
       |-ValueObjects
           |-Project.xml

    I have specified the ValueObjects as a dependency in both the client and server projects.

    <dependency>
    <groupId>group-id</groupId>
    <artifactId>valueobject-artifact-id</artifactId>
    <version>project-version-number</version>
    </dependency>

    So the processing order is being taken correctly.

    Our processing order:
    VO
    Server
    Client

    But when it is trying to build the server project or client project, the build is failing since it is looking for the VO.jar in the local repository. This jar is present in my build directory - maven.build.dir. How can I overcome this ?

    Please help me out. Thanks in advance.
  2. If I remember correctly, you need to do a jar:install on your subprojects to put them in the local repository. Some of the other goals will do this for you too.

    Then, when your other projects try to get them from the local repo, their current versions will be available.

    Hope this helps.
  3. Thanks Christopher. This did solve my problem and the build was a success.

    But while creating a distribution jar for a project, I would like to bundle the dependent jars for the project along with the project jars. For a war, there is some property called war.bundle = true, but in the case of an ear or jar, is there any such property ?