本文介绍了如何在主机Artifactory中进行配置以重用Maven的settings.xml文件中定义的存储库位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个LAN,其中每台开发人员计算机都安装了 Maven ,当然,每个开发人员计算机都有自己的存储库,该存储库通过 settings.xml 文件(通过< localRepository> 部分,例如:

I have a LAN, where each developer machine has Maven installed and of course each one has its own repository defined through the settings.xml file through the <localRepository> section, for example:

  • \ username \ maven \ repository (自定义)

这是一种通用方法,与操作系统是Linux,Mac还是Windows无关!

It how a generic way, it without matter if the OS is either Linux, Mac, or Windows

目标是在局域网中只有一台计算机,以便允许同一局域网中的其他计算机访问其自己的存储库,当然是让它们根据需要或要求引用通过他们的项目.因此如下:

The goal is have just one machine in the LAN to let access to its own repository for the other machines in the same LAN, it of course to let them refer the dependencies as they need or request through their projects. Therefore as follows:

* Developer Master [central repository in the LAN]
* Developer Alpha
* Developer Beta
* Developer Delta

因此,Alpha,Beta和Delta是依赖的开发人员机器-自从现在称为 DDM .这些DDM应该可以访问Master可用的依赖项,这对于不要下载或从Master到自己复制这些jar依赖项很重要-只需引用它们即可;因此,目的是在这些DDM中节省硬盘空间.而且,如果在这些DDM的某个项目中声明了通过pom.xml文件的新依赖关系,则应将其下载到主文件中,其余所有DDM也可以访问该文件.

Therefore Alpha, Beta, Delta are dependent developer machines - since now referred as DDM. These DDM should get access to the dependencies available by Master, is important to do not download or make a copy of those jars dependencies from the master to themselves - just refer them; therefore the purpose is save space about hard disk in these DDM. And if in some project from these DDM is declared a new dependency through a pom.xml file should be downloaded into the master and be accessible to all the rest DDM too.

我对此进行了研究,发现可以通过共享远程目录进行操作,但是根据答案和评论,同步并不安全.他们中的许多人建议使用 Nexus Artifactory .

I did a research about this, and I found something about to work through a shared remote directory, but according with the answers and comments, it is not safe about synchronization. Many of them suggested Nexus and Artifactory.

我已安装

  • JFrog Artifactory OpenSource 7.4.3

我需要通过分步说明来管理这些情况(当然,当然可以):

I need manage these scenarios through step instructions (of course if is possible):

问题1:在主系统中

  • 如何根据 settings.xml < localRepository> 值配置 Artifactory 以重用Maven的存储库?
  • How configure Artifactory to reuse the Maven's repository according with the settings.xml's <localRepository> value?

因此这些DDM会通过 Artifactory 加入该< localRepository> 位置,而不是直接通过随时可能出现的共享远程目录进行访问有关同步的问题.

Therefore these DDM are acceding to that <localRepository> location through Artifactory and not directly through a shared remote directory where anytime can arise issues about synchronization.

问题2:在每个DDM中

  • 如何配置每个Maven的 settings.xml 文件以引用远程 Artifactory ?
  • How configure each Maven's settings.xml file to refer the remote Artifactory?

因此,其目的是避免为DDM中的每个项目配置每个 pom.xml 文件.这会很冗长.

Therefore, it with the purpose to avoid to configure each pom.xml file for each project in the DDM. It would be verbose.

我确实在youtube和JFrog官方文档中进行了研究,但没有走运.

I did do a research in youtube and official JFrog documentation and had not luck.

目标:在主计算机中具有与Spring,JUnit 5,Hibernate等有关的Maven存储库目录,它们应该通过 Artifactory 可用于所有DDM.

Goal: having in the Master Machine the Maven repository directory with dependencies about Spring, JUnit 5, Hibernate and others, they should be available for all the DDM through Artifactory

推荐答案

不可能.

每个用户都需要他们自己的本地存储库.

Each user needs their own separate local repository.

让Artifactory从那里绘制工件很有用,但是最后,需要在使用前将其复制到开发人员的本地存储库中.

It is useful to have Artifactory to draw the artifacts from there, but in the end, the need to be copied to the developer's local repository before use.

这篇关于如何在主机Artifactory中进行配置以重用Maven的settings.xml文件中定义的存储库位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 18:21