0

I want to split a mvn install command into 2 separate ones - dependency resolution and build itself, like it can be done in NPM (with npm run ci and npm run webpack separately). The reason to do so is to measure how much time is spend on dependency resolution and how much on build itself.

I have tried to use mvn dependency:go-offline with mvn install -o afterwards. According to docs this is exactly what I need, however it does not work. Plugin dependencies are not downloaded (mentioned in pom file under build/plugins).

Can this goal be achieved somehow?

Somnium
  • 1,059
  • 1
  • 9
  • 34
  • 2
    To measure that you can simply run your full build and rerun the build... The first time all downloads will be done ...with the second run they will not downloaded against because they will be cached in `$HOME/.m2/repository`.... – khmarbaise Apr 04 '22 at 16:05

1 Answers1

0

Indeed, it seems the dependency:go-offline standard goal is not "perfect" as some plugins may still trigger some (re)downloading during the mvn package phase.

(I had noticed this when looking at this SO question about how to optimally rely on Docker's cache.)

To fix this, you can try mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies after installing the corresponding plugin mentioned in this SO answer by @user2813807.

ErikMD
  • 13,377
  • 3
  • 35
  • 71
  • Seems that I will need to specify manually all dynamic dependencies in POM which is really inconvenient. – Somnium Apr 04 '22 at 16:23