Chris Beach
Chris Beach

Reputation: 4392

In Maven how can I recursively build -SNAPSHOT dependencies present in the filesystem but outside the reactor?

I have two projects as follows, in neighbouring directories on the filesystem:

I'd like to build project_b and for Maven to discover that project_a exists on the filesystem and thus build it rather than look in the local repo for its artifact.

I could build these within an aggregator and use the reactor to select project_b i.e.

mvn --projects project_b [goal]

However, this is problematic because

Is there a neat way I could get Maven to perform a recursive build that looks on the filesystem to find -SNAPSHOT dependency projects and builds them?

Upvotes: 4

Views: 3820

Answers (2)

kenglxn
kenglxn

Reputation: 2038

I needed this a while back and made a simple recursive wrapper cli in nodejs. https://github.com/kenglxn/mvnr/blob/master/README.md

Install from npm with

sudo npm install -g mvnr

Then just pass any maven command to mvnr, and it will run that command on all mvn projects under the cwd.

Upvotes: 2

Eugene Kuleshov
Eugene Kuleshov

Reputation: 31795

You could play with Maven Reactor plugin, e.g. try mvn reactor:make -Dmake.folders=foo,bar

Upvotes: 1

Related Questions