user2022068
user2022068

Reputation:

Maven: build another war-project when current project has been built

I have two war projects - A and B. B project includes A project at building time and is deployed to server. A project is not deployed to server.

B includes A this way:

<dependency>
    <groupId>${project.groupId}</groupId>
    <artifactId>projectA</artifactId>
    <version>${project.version}</version>
    <scope>runtime</scope>
     <type>war</type>
</dependency>

What I want - every time I build project A, project B must be build when building of project A is over. How can I do that?

Upvotes: 0

Views: 34

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328614

You have two options:

  1. Convert the two projects into Maven modules (i.e. copy them as folders into a Maven project) and then add this to your POM:

    <modules>
        <module>A</module>
        <module>B</module>
    </modules>
    

    Longer explanation: http://books.sonatype.com/mvnex-book/reference/multimodule.html

  2. Use a CI server with two jobs (one for A and one for B) and use the tools of the CI server to define the dependency.

Upvotes: 1

Related Questions