This is not a problem when it comes to a single classloader. If there is more classloader, there will be a problem.
Assuming that the project has two modules, Module2 relies on Module1
After we perform the MVC eclipse:eclipse and then look at the. classpath file under Module2, you will find: <classpathentry kind= "src" path= "/module1"/>.
If Module1 is pom.xml, we declare a third-party dependency (assuming Servlet-api) scope:provided. You will find that the BuildPath in Module2 will still have this third-party dependency (SERVLET-API). Even if you are in the Module2 Pom.xml in Module1 to exclude servlet-api actual or transitive existence.
Typically with a single appclassloader scenario, you may not need to focus on this issue. But if you rely on these classpath to classloader problems, there will be problems.
Workaround:
Declare maven-eclipse-plugin in the Project Master Pom and configure the following to block references to this module.
Specific instructions are as follows: https://maven.apache.org/plugins/maven-eclipse-plugin/examples/prevent-module-references.html
After you re-execute MVN eclipse:eclipse, review the module2. classpath file, <classpathentry kind= "var" path= "M2_repo/com/xxxx.../{version }/module1-{version}.jar ". Check the BuildPath at this time and clean.
Note: This problem is not present in Intellj idea.
Eclipse avoids dependency-referenced scenarios between modules in a multi-modules project structure