简体   繁体   English

eclipse maven 依赖项在 maven 更新项目后移动到类路径下

[英]eclipse maven dependencies moved under classpath after maven update project

In a maven project in eclipse version 2019-12, in "Java Build Path", I dragged "Maven Dependencies" from "Classpath" to "Modulepath".在eclipse 2019-12版本的maven项目中,在“Java Build Path”中,我将“Maven Dependencies”从“Classpath”拖到“Modulepath”。 But after clicked "Maven -> Update Project...", the "Maven Dependencies" is automatically moved under "Classpath" inside "Java Build Path".但是在单击“Maven -> Update Project...”后,“Maven Dependencies”会自动移到“Java Build Path”内的“Classpath”下。 Is it a normal behavior in eclipse?这是日食中的正常行为吗? Thanks.谢谢。

Yes, the Maven Dependencies item is always shown under Classpath and moving to Modulepath has no effect.是的, Maven Dependencies项总是显示在Classpath,移动到Modulepath没有任何效果。

This is a side effect of how classpath separation is implemented.这是实现类路径分离方式的副作用。 If and only if there is a module-info.java file:当且仅当存在module-info.java文件:

  • JARs to be used in src/main/java and src/test/java (not only visible for test sources) are on the modulepath要在src/main/javasrc/test/java使用的 JAR (不仅对测试源可见)位于模块路径上
  • whereas test scope JARs (to be used in src/test/java ) are on the classpath .测试范围 JAR (将在src/test/java )在classpath 上

For projects without a module-info.java file, all dependencies are added to the classpath.对于没有module-info.java文件的项目,所有依赖项都添加到类路径中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM