0

I work with a large Maven project with many modules. When I run mvn package -pl mymodule, it first runs the package lifecycle phase of all the modules that mymodule depends on.

Some of these other modules have a maven-assembly-plugin step to create .tar.gz files, which is annoyingly slow.

I only need compilation of the other modules and creating their jars in order to create the assembly for mymodule. Yet because of the way this project is structured, packaging mymodule always requires all dependencies to be re-assembled.

What's the preferred way to speed up this build?

PBJ
  • 757
  • 8
  • 21
  • Can you deploy your dependencies to your local maven repo, or better, to a shared artifact repository like Nexus? And are all dependencies via SNAPSHOT, version ranges, or strictly versioned? The best solution can vary depending on your situation. – Paul Hicks Mar 31 '16 at 03:14
  • The dependencies are all in this single monolithic repo. Aha - I just tried installing to my local repo by mvn install, and now it does not attempt to build dependencies when I run mvn package. Post that as answer and I'll accept; thanks! – PBJ Mar 31 '16 at 03:30
  • Actually, it looks like the key was to avoid the -am flag after installing. Before running 'mvn install', omitting -am caused failure, but now I can safely leave it out. So this alleviates the problem but doesn't really solve it fully, because on the first "mvn install" I am still unnecessarily creating assemblies. – PBJ Mar 31 '16 at 04:06
  • check this SO post, it will give you further hints http://stackoverflow.com/questions/35603795/what-is-the-difference-between-using-maven-pl-option-and-running-maven-from-mod – A_Di-Matteo Mar 31 '16 at 08:01

0 Answers0