x__dos
x__dos

Reputation: 1823

How to build and install maven dependency while build a project?

I've got two maven projects A and B, A depends on B. When B gets updated, I need to perform following steps (to build A):

  1. build B
  2. install B
  3. build A

Is it possible to combine steps 1 & 2 together, and build and provide a jar of project B to A automatically?

Upvotes: 0

Views: 82

Answers (1)

Sled
Sled

Reputation: 18939

You can try to use a mutli-module parent pom to build both at once. It's not the same thing exactly, but it makes it much easier when working with multiple poms. A build clean install on the parent pom will do the same to each of its children and they will see the latest version available.

Actually, for your case you are probably better of doing mvn clean install which combines steps 1 & 2 into one command line. Install will build if there is no source available. Multi-pom is better if you have that situation with multiple poms (our case 5).

Also, you could write a quick batch script or a single line of PowerShell or Bash to do what a batch script could do.

Upvotes: 3

Related Questions