Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven provided scope and eclipse runtime classpath

I've got a problem with my eclipse classpath with the m2e plugin. I have a project which depends on other projects in my workspace. I've added these dependencies as maven dependencies with scope provided. I expect the scope to do the following: Provide the dependencies for compilation but exclude them for the runtime classpath. Because at runtime, these classes should be loaded from jars inside a folder.

But the eclipse classpath includes every single dependency I've provided in the project pom. Eclipse seems to ignore the provided scope. Is there any way to exclude those from runtime classpath?

Regards

like image 581
kiwilisk Avatar asked Nov 14 '22 06:11

kiwilisk


1 Answers

If you want dependencies to be "provided for compilation but excluded from runtime classpath" you need to use the "provided" dependency scope (a Maven term) rather than the "compile" scope, which Maven uses by default.

like image 91
fwc Avatar answered Nov 16 '22 04:11

fwc