Learner
Learner

Reputation: 544

Does maven support concurrent execution of different projects

I have a query regarding maven.

Does maven support concurrent execution of different projects which are not related.

To elaborate it more;I have 4 different projects and i want to run "mvn site" command on all of them on 4 different terminals.

So the question is,Does maven support this feature.

Thanks

Upvotes: 1

Views: 98

Answers (2)

333kenshin
333kenshin

Reputation: 2045

@Raj Jain,

By "different projects which are not related" I take you to mean each one has a different pom file sitting in a different directory. If so, then the answer is yes, but.

Yes, in theory, you can build all of them concurrently, for instance running 4 xterms concurrently, cd to each one's respective dir, and run mvn clean install in rapid succession.

And yes, each of the builds will run in its own directory in a self-contained manner, creating a local subdir called target/ to store all the build artifacts.

But there is a slight risk of builds interfering with one another as they write to what's called the local repo. Especially if they depend on the same jars, they might write the same file to the same folder simultaneously, causing the build to get corrupted. This doesn't happen often, especially after the first time the build runs since the local repo is now fully populated.

However, if you want extra insurance against this kind of collision, then have each of the builds write to their own repo using mvn -Dmaven.repo.local=/tmp/repository1/

Hope that helps.

Upvotes: 1

sanigo
sanigo

Reputation: 645

Add all the artifacts to a pom.xml as modules, so when you run mvn site on the pom.xml, all modules should be called.

Upvotes: 0

Related Questions