jnxplus and nx remote caches
Closed this issue · 3 comments
Hey there,
I have another performance suggestion. For context:
We have a NX Monorepo with about 150 nx maven projects.
A build nearly always results in a complete fullbuild (even with affected), because every change results in all dependencies to be build and all projects using your changed projects (and all there dependencies too). It cascades up to all the apps resulting in a fullbuild.
To takle the build time we switched from local caching to remote caching.
But because we only cache the target folder of the maven project, we still need to run an install:install in a seperate step to install all jars in the target folders to be able to build the dependend projects. This still is a huge hit too performance, because we run 300 buildsteps now.
Maybe the local m2 repository could be used to circumvent the additional install step, if for each project a simlink is created inside the m2 repository targeting the corresponding jar file in target folder (also for pom file).
This way we would only need to run a mvn package in each project and get a completely remotely cacheable result.
Best regards
Hi @shanon84
What are you asking for is already implemented, you need two steps to make it working:
-
Add
localRepoRelativePath
to the plugin option (nx.json), so you can generate.m2
inside the workspace. -
Add
{options.outputDirLocalRepo}
to the outputs of the project you want to save its cache, by default it's libs and parent projects.
Check this Repo for examples: https://github.com/khalilou88/jnxplus-examples
@khalilou88 sry for the late response. Thank you very much. Tried it out and it works like a charm!
You are welcome. Just want to add that the first step is important because Nx don't allow absolute path for target outputs: nrwl/nx#20961