Issue
My project has a dependency (Provided Scope
), then If I run my project under Test Scope
for unit tests, then how does Maven find this dependency it needs during unit testing?
Would Maven just use the one in local maven repository (if exists)?
Thank you.
Solution
From official documentation:
A dependency with this scope is added to the classpath used for compilation and test, but not the runtime classpath.
So yes, during test phase the dependency will need to be available (or will be downloaded) in your local Maven repo.
Answered By - SiKing
Answer Checked By - Mary Flores (JavaFixing Volunteer)