Eclipse为什么将Maven运行时依赖项转换为编译依赖项?

编程入门 行业动态 更新时间:2024-10-23 02:08:43
本文介绍了Eclipse为什么将Maven运行时依赖项转换为编译依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个导入到Eclipse Oxygen的Maven项目. Eclipse报告没有编译问题(Alt + F5).当我从命令行运行maven时,我得到了

I have a maven project imported into Eclipse Oxygen. Eclipse reports no compile issues (Alt + F5). When I run maven from the command line I get

[ERROR] /home/dean/src/TAP3UIs/TAP3Desktop/src/main/java/com/ms/tap3/controller/RequestAccessController.java:[8,30] package com.googlemon.base does not exist

该软件包确实存在于guava-15.0.jar中的我的.m2/存储库中.我也可以在Eclipse mvn依赖项中看到它.当我查看项目的mvn dependency:tree时,我会看到

That package does exist in my .m2/repository in guava-15.0.jar. I can also see it in Eclipse mvn dependencies. When I check the mvn dependency:tree for the project I see

[INFO] | | | +- com.google.guava:guava:jar:15.0:runtime

它是命令行上的运行时传递依赖项,这说明了为什么它不能在命令行上编译. Eclipse某种程度上已将可传递的依赖项从运行时转换为编译.

It is a runtime transitive dependency on the command line, which explains why it doesn't compile on the command line. Somehow Eclipse has turned a transitive dependency from runtime to compile.

有人知道为什么会发生这种情况吗?我如何使Eclispe m2e尊重传递依赖项的范围?

Does anyone know why this happens and how I make Eclispe m2e respect the scope of the transitive dependencies?

推荐答案

当前,两个 JDT m2e 也不支持每个项目支持不同范围的多个类路径.

Currently, neither JDT nor m2e support multiple classpaths per project which is required to support different scopes.

请参阅: Eclipse错误486035-不同作用域的不同类路径容器

更多推荐

Eclipse为什么将Maven运行时依赖项转换为编译依赖项?

本文发布于:2023-07-14 21:51:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1107247.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   Eclipse   Maven

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!