eclipse 如何从 Effective POM 中删除存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18079368/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:02:10  来源:igfitidea点击:

How to remove repositories from Effective POM

eclipsemavenmaven-plugin

提问by aquila

I have hard times learning Maven those days, it seems more difficult than learning all 4-5 programming languages I know altogether. However first steps are made and I succeeded to build a first Java REST services project based on Jersey in Eclipse with m2eclipse plugin. As I tried to do that I added a bunch of global repositories most of which are either irrelevant or incorrect and somehow I added all of them to 'Effective POM' instead of project POM so there are number of garbage repositories globally. Now the question:

那些天我很难学习 Maven,这似乎比学习我所知道的所有 4-5 种编程语言更难。然而,第一步已经完成,我成功地使用 m2eclipse 插件在 Eclipse 中构建了第一个基于 Jersey 的 Java REST 服务项目。当我尝试这样做时,我添加了一堆全局存储库,其中大部分是不相关的或不正确的,并且以某种方式将它们全部添加到“有效 POM”而不是项目 POM 中,因此全球有许多垃圾存储库。现在的问题是:

How can I edit/manage 'Effective POM' in order to remove those repositories? I tried to do that with built in POM editor but it shows it as read-only, also tried to remove them through 'Maven Repositories' tab but there is no such option at all.

如何编辑/管理“有效 POM”以删除这些存储库?我尝试使用内置的 POM 编辑器来做到这一点,但它显示为只读,也尝试通过“Maven 存储库”选项卡删除它们,但根本没有这样的选项。

Maybe there is some way to edit it manually, where does global POM resides in file system?

也许有一些方法可以手动编辑它,全局POM驻留在文件系统中的哪个位置?

In 'Effective POM' I can see added repositories duplicated in both tags <repository>and <pluginRepository>. What is the difference between those tags? If I remove them manually, should I remove both?

在“有效 POM”中,我可以看到添加的存储库在标签<repository><pluginRepository>. 这些标签有什么区别?如果我手动删除它们,我应该同时删除它们吗?

回答by miko?ak

The "Effective POM" is what Maven constructs when it parses your project. It's composed of your POM and its (grand)parent POMs. The Effective POM does not exist on your filesystem per se, it's generated on-the-fly whenever your run a Maven build- hence why the view is "read-only".

“有效POM”是当它分析你的什么项目的Maven构建。它由您的 POM 及其(祖)父 POM 组成。有效 POM 本身不存在于您的文件系统中,它是在您运行 Maven 构建时即时生成的- 因此该视图是“只读”的。

In other words - you haven't added those repositories to your Effective POM, but to one of your project's ancestor POMs, or one of the settings.xml filesresolved by mvn and/or Eclipse. Remove those entries from there and your problem will be solved.

换句话说 - 您没有将这些存储库添加到您的 Effective POM 中,而是添加到您项目的祖先 POM 之一,或由 mvn 和/或 Eclipse 解析的 settings.xml 文件之一。从那里删除这些条目,您的问题将得到解决。