Eclipse为什么将Maven运行时依赖项转换为编译依赖项? [英] Why does Eclipse turn a maven runtime dependency into a compile dependency?

查看:119
本文介绍了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.google.common.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运行时依赖项转换为编译依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆