I have a Maven project that has several submodules. because we have dependencies between some of them, we need to run the build from the parent pom.

Because there are a lot of unit tests the build takes a long time. sometimes we are only modifying a single module but we need to wait for everything to build and run tests.

I have an idea of using git diff to ignore the test in unmodified submodules. I started with a python program and I can get the diff and find the modules with changes.

but this will require a separate program to run and execute mvn.

So I started thinking about doing a plugin for mvn that either extends or is a dependency to maven-surefire-plugin.

Is this possible can I change the behavior of another mvn plugin. I not familiar with developing mvn plugin. I wanted to get feedback from people with experience on it or find out if there is another solution.

1 Answer 1


This may not answer your question directly. However, I believe you could use the -pl flag to build only those modules that you actually modified.

Something like - mvn -pl library1 clean install, would cause only the submodule library1 to be built and installed.

Related/helpful StackOverflow question here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.