简体   繁体   English

Nexus / Maven如何不通过Nexus代理所有内容

[英]Nexus/Maven how do you NOT proxy everything through Nexus

I only want to use Nexus for our projects libraries and not deal with the overhead of resources and proxying every possible repository someone might use. 我只想将Nexus用于我们的项目库,而不希望处理资源开销和代理人可能使用的每个可能的存储库。 Is this possible and simple to accomplish? 这可能并且容易实现吗?

It's more than advisable to have a company hosted artifact repository manager. 建议由公司托管工件存储库管理器。 Together with repository groups and some basic routing rules, this will: 连同存储库组和一些基本的路由规则,这将:

  • Decrease your external traffic for artifacts. 减少工件的外部流量。

  • Decrease the amount of time required in order to download the artifacts. 减少下载工件所需的时间。

  • Help you control where artifacts are obtained from. 帮助您控制从何处获取工件。

  • Help you control what artifacts end up in your project. 帮助您控制项目中最终出现的工件。

  • Allow you to keep working, even if Maven Central is (for whatever reason) down, or you're experiencing Internet issues (or lack a connection to the Internet). 即使Maven Central(无论出于何种原因)宕机或遇到Internet问题(或无法连接Internet),也可以继续工作。

  • Provide consistency. 提供一致性。

Running an artifact repository manager on your dev machine is actually often a good practice as well. 实际上,在开发机器上运行工件存储库管理器通常也是一种好习惯。

I'm not quite sure why you're like to not have all the artifacts served through your own repository, if you already have one, as this will benefit you quite a lot. 我不确定您为什么不希望通过自己的存储库提供所有工件,如果您已经拥有一个,因为这将使您受益匪浅。

If your really must use your repository server just for your internal artifacts, then you'll need to add additional <repository/> sections to your pom.xml files. 如果您确实必须仅将存储库服务器用于内部工件,则需要在pom.xml文件中添加其他<repository/>部分。 Instead of doing this, you can simply use your repository manager, use a group repository and define in your settings.xml that your company repository is acting as a <mirrorOf/> Maven Central. 无需执行此操作,您可以简单地使用存储库管理器,使用组存储库并在settings.xml中定义您的公司存储库正在充当<mirrorOf/> Maven Central。

Yes, you can do that. 是的,你可以这么做。 If you dont use a settings.xml mirror setting you can add the Nexus repositories to your settings.xml or pom.xml and proceed. 如果您不使用settings.xml镜像设置,则可以将Nexus存储库添加到settings.xml或pom.xml中并继续。

Obviously (for the reasons mentioned above) this is not ideal, but its possible ;-) 显然(由于上述原因),这不是理想的,但是可能的;-)

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

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