With maven ... probably not that easy. You might want to follow  for bundles; for content-packages you can either raise a Daycare ticket; and/or post a comment to the maven archetype you use and raise attention to your problem. I am sure that others are affected as well.
I am using content package plugin in mvn to install the package. If this is being handled by sling post servlet, how can we check the availability of package manager in mvn script before post servlet tries to install.
Here I don't think it is the issue with jenkins setup as sometimes packages are getting installed and in next job runs getting the error. I am not sure if the previous package uploads sometimes triggers the package manager service restart and by the time next module package is getting installed, service is still down.. I am just guessing as this issues happens from 2nd module onwards.. I tried to setting timeout in package content plugin to 10 mins still it is not fixing the issue... Same error now and then..
I am using Jenkins to build the code. I am using clean install goal. Packages are built fine but issue seems to be happening when installing the package on AEM. Sometimes it works and sometimes it fails.