Avoid duplicate build step executions in the Travis build
Activity
Yoann RodièreNovember 29, 2017 at 5:15 PM
So, we discussed on HipChat of only executing mvn install
once, and [using -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
https://stackoverflow.com/a/35233140/6692043] to disable download progress in logs. |
But it turns out this early mvn install
execution is also necessary to execute mvn checkstyle:check
just before the build (to fail fast), because checkstyle requires all dependencies to be resolved.
So removing the early mvn install
execution is possible, but would require to remove the early checkstyle execution.
Since we don't want that, I won't remove it.
Yoann RodièreNovember 29, 2017 at 3:59 PM
But I'll give it a try.
As I thought, it doesn't work: https://travis-ci.org/yrodiere/hibernate-search/jobs/309039178#L642
Executing the go-offline goal requires a "standard" dependency resolution first, so even if we exclude artifacts from the resolution in 'go-offline', the "standard" resolution will ignore these exclusions and fail when not finding "hibernate-search-engine" for instance.
Yoann RodièreNovember 29, 2017 at 3:21 PM
> You could have it skip the build phase at the first run; did you try mvn dependency:go-offline ?
I tried dependency:resolve-dependencies
, and it didn't work because the goal requires to resolve all test dependencies first (I know, it's weird). And since we have internal dependencies between our plugins, dependency resolution ends up failing because we haven't installed the artifacts yet...
The go-offline goal seems to suffer from the same issue, as mentioned here: https://maven.apache.org/plugins/maven-dependency-plugin/go-offline-mojo.html . But I'll give it a try.
Sanne GrinoveroNovember 29, 2017 at 3:13 PM
You could have it skip the build phase at the first run; did you try mvn dependency:go-offline ?
Yoann RodièreNovember 29, 2017 at 3:07 PM
What are the slow plugins you're talking about?
The main issue was the asciidoctor plugin, which is very slow when it generates the PDF. I ended up disabling PDF generation. Note that I need to use the -Pdist profile because if I don't, some dependencies are not downloaded during the first maven execution and I end up with too much stuff in the logs.
But there are other issues that I couldn't solve. Currently this first maven execution takes about 3min 20s on Travis even if there is nothing to download...
Most of the execution time is caused by the compiling and building artifacts even though we don't need to, since we just want to download dependencies.
I tried to disable some plugins selectively, but the inter-plugin runtime dependencies (one plugin expecting another to have generated some files) are too complex. And I've already tried to use the maven-dependency-plugin some time ago, it doesn't work either.
So. I'll solve the asciidoctor problem as part of this ticket, but I will gave up on these remaining extra 200 seconds.
For each build, we currently run maven a first time, skipping tests, just to download dependencies.
Maybe we could avoid running some slow plugins during this first execution, just to reduce the build time.