Search code examples
javaeclipsemavenspring-bootm2eclipse

m2Eclips plugin: Resolve Workspace Artifacts - is it a good practice


Hello I am working on a Maven project that requires me to enable "Resolve Workspace Artifacts" at the time of Maven Build operation. Without which I get build failure as certain dependencies are not resolved.
From this link I understand what "Resolve Workspace Artifacts" does. To give background: I am starting fresh, with nothing in my local m2 repo. I am cloning a project from Git Lab and while the "mvn clean install" is being run I enable "Resovle Workspace Artifacts".
This is a multi-module maven project.

I want to understand...
1. If this OK (Maven project defined such that it requires us to enable "Resolve Workspace Artifacts")?
2. Could this issue have arised due to incorrect/bad design of Maven project dependencies?
3. If left as it is will there be any issues if I plan towards CI-CD phase?

This is a Spring Boot web project


Solution

    1. Ideally it should be avoided, but it helps and may be faster if you are concurrently developing multiple projects that are in your workspace, but for whatever reason can't already be installed in a resolvable repo. But really you could just run mvn install on those dependencies to at least get them into your local repo. Though I can see how that might be a 'step too many' when you're just messing around with the code and want to iterate quickly (on the other hand why would you do a full maven build then).

    2. Perhaps for some reason you haven't pushed/installed another one of your own projects, but that the one with the issue is depending on. Without it being in the local or remote publicly resolvable repo, there is no way for maven to resolve it without "Resolve Workspace Artifacts". But yes, it could be an issue with your dependency tree - difficult to assess without your pom.

    3. No issue as long as the CI/CD server can fetch the missing dependencies.

    If the missing dependencies are hosted in a private repository, the likely solution is to add a <repository> entry in your pom.