有没有一种方法可以禁用本地Maven存储库? [英] Is there a way to disable the local maven repository?

查看:199
本文介绍了有没有一种方法可以禁用本地Maven存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这听起来很疯狂,但是我们的开发人员都在同一台Linux机器上工作,该机器还安装了nexus作为我们的Maven存储库.实际上,每个人最终都会在其〜/.m2/文件夹中出现伪像,这些伪像也已在nexus服务器中复制.

This may sound crazy but we have our developers all working on the same Linux machine, this machine also has nexus installed as our maven repo. Effectively everyone ends up with artefacts in their ~/.m2/ folder which are also duplicated in the nexus server.

是否可以简单地告诉maven仅查看联系中的伪像?

Is it possible to simply tell maven to only look at the artefacts in nexus?

目前我已经在全局Maven配置中设置了属性<localRepository>/path/to/global/repo</localRepository>,但是不确定如果两个用户同时抓取同一文件是否会导致问题.

I have for the moment set the property <localRepository>/path/to/global/repo</localRepository> in our global maven config, but unsure if this could cause a problem if two users are grabbing the same file at the same time.

之所以这样做,是因为该公司不会向我们购买功能强大的工作站,所以我们都使用SSH来开发服务器.

We do this because the company won't buy us powerful workstations so we all ssh to our development server.

推荐答案

我不想将我的本地存储库指向nexus数据存储,因为这样安装会更新nexus背后的存储库数据存储.

I wouldn't want to point my local repo to the nexus datastore, because then installs would update the repository datastore behind nexus' back.

不过,您可以将单个计算机"本地存储库设置为与nexus数据存储区分开,
然后为每个用户将~/.m2/repository目录更改为指向本地"本地存储库的符号链接.

However you could set up a single "machine" local repo separate to the nexus datastore,
and then for each user change the ~/.m2/repository directory to be a symlink pointing to the "machine" local repo.

至少您将只有2个该回购副本.

At least then you'll only have 2 copies of the repo.

并发安装和下载仍然可能互相干扰,但这可以通过令人讨厌的重做来解决.

Concurrent installs and downloads, are still likely to clobber one another, but this can be fixed with an annoying redo.

更新:

有一个新的解决方案可用.

There is a new solution available.

安装TEAM(针对Apache Maven的Takari扩展)扩展,可提供线程安全的本地存储库以及针对多模块构建的改进算法.

Installation of the TEAM (Takari Extensions for Apache Maven) extensions, provides a thread-safe local repository and an improved algorithm for multi module builds.

请参见 http://takari.io/book /30-team-maven.html#concurrent-safe-local-repository

这篇关于有没有一种方法可以禁用本地Maven存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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