0

So this humungous package is trying to get installed on my VM for the past 5 hours. Its still going strong and looks like it has downloaded the entire Internet already. I need to shut my laptop down. Is there a command line tool to tell Maven to take a break, chill for some time, and resume from where it left later?

Edit: I see a very subtle difference between this and the existing question that has been pointed out. I have been using the -rf flag to recover from a failed build for some time now. But I am not aware of the intricacies of the workings of Maven so I wasn't sure if it would be able to recover if I killed the mvn process from the command line (or if my laptop ran out of battery and was forced to shut down), even if the build process was going on smooth. Here's an analogy - I like to think of Maven as someone managing a complex set of tasks. If some task fails, the manager keeps note of that, halts all the operations and reports to the seniors and waits till his issue is fixed. I believe that as soon as maven finds out something has broken, it saves the state of the build process to be able to resume later. But what happens if someone comes and kills the manager. Or in the case of what I did, if I kill -9 the maven process. Would maven be able to save a copy of the build state? I wasn't so sure. That's what I wanted to check

PintoUbuntu
  • 41
  • 1
  • 8
  • Have you installed a repository manager like Nexus? – khmarbaise Jun 17 '16 at 06:38
  • well, ideally you can stop the build at any moment, re-launch it later on and whatever was already downloaded (cached locally) would not be downloaded again: that's the main idea/gain of a local cache. – A_Di-Matteo Jun 17 '16 at 07:08
  • When you say _stop the build_, what would be a good way to do so? I did a kill -9 maven pid – PintoUbuntu Jun 17 '16 at 15:30

1 Answers1

1

You can use -rf command line switch to restart the build from given package.

For example if your project consists of parent, child1, child2 builds, you can stop the build e.g. at child2 and restart it using (assuming you were doing clean install):

mvn clean install -rf :child2
Krzysztof Krasoń
  • 26,515
  • 16
  • 89
  • 115