即使Workspace解析不起作用,如何使Eclipse使用Maven项目? [英] How make Eclipse uses maven projects even if Workspace resolution is not working?
问题描述
从理论上讲,启用Workspace解析应该使Eclipse使用当前项目,而不是转到存储库.
In theory, enabling Workspace resolution should make Eclipse to use the current project rather to go to the repository.
但是由于不同的原因,它可能会失败.就我而言,有两个项目A和A-test.他们两个都有
But it may fail, for different reasons. In my case, two projects A and A-test. Both of them have
- 许多子项目/模块
- 提到此类模块的主要pom.xml
我将所有这些导入到同一工作区中.
I imported all of them in the same workspace.
现在,当在A-test中运行项目时,要查看A更改的影响的唯一方法是执行 mvn install
,以便在本地存储库中更新jar.
Now, when running project in A-test, the only way to see the effect of a change in A is do a mvn install
, so the jar is updated in local repository.
启用工作空间分辨率无济于事.虽然,当从Eclipse调试时,它可以工作.真是一团糟.
Enabling workspace resolution wasn't helping. Although, it sort of works when Debugging from Eclipse. A real mess.
那么,如何确保A-test中的项目正在查看Eclipse的A?
So, how can I make sure projects in A-test are looking at Eclipse's A?
推荐答案
似乎工作区分辨率不准确.通过通用/全局pom.xml关联项目时,它似乎可以正常工作.
It seems the workspace resolution is not exact. When projects are related through a common/global pom.xml, it seems to work.
因此,就我而言,对于A测试中的每个项目,我都做了
So, in my case, per project in A-test, I did
- 右键单击,构建路径,配置构建路径
- 标签项目":添加所有A项目(在我看来,这很安全)
- 标签订单和导出":确保A项目在M2中是BEFORE项目之前.我只是将所有A项目移到顶部.
现在,当我在A-test中运行一个项目时,它正在查看A.
Now, when I ran a project in A-test, it's looking at A.
注意:-日蚀氧气-A完全不依赖A测试.
NB: - Eclipse Oxygen - A does not depends on A-test, at all.
这篇关于即使Workspace解析不起作用,如何使Eclipse使用Maven项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!