Docs feedback: Usage of caches / artifacts for Maven target folder
In https://docs.gitlab.com/ee/ci/examples/artifactory_and_gitlab/index.html Maven target folder is cached between different stages. While this makes sense to me, to not compile things several times I'd read https://docs.gitlab.com/ee/ci/caching/#cache-vs-artifacts that probably an artifact should be used, for such scenarios. Using caches I'd see the issue that concurrent builds could corrupt Jobs in later stages, as they could suddenly continue to work on the target folder of another Pipeline.
What is your opinion about it? At least things should be described consistent from my point of view, potentially even an own example or chapter about this topic could be interesting. I think things are similar for Gradle.
Another solution option would be to allow several caches in the same job, e.g. one with a globel key for dependencies and another one with a Pipeline-ID-Key for something like the target folder.