2

全部

需要让 maven 将中心依赖项复制到本地文件系统存储库镜像。无法解决如何在 maven (3.3.1) 中执行此操作。

我们有:

[1] maven central,对于英国来说是:“ http://uk.maven.org/maven2

[2] 本地远程文件系统仓库镜像:“c:/mylocalRepository”

[3] 本地仓库“c: /users/myuser/.m2/repository

maven 的版本是 3.3.1(从 2.0.10 迁移)。

我们需要在不连接到中央(防火墙后面)以及不使用存储库管理器(Nexus、Archiva 等)的情况下运行我们的系统——这是我们想要改变但不能立即改变我们的基础设施的东西。请不要回复只是说这样做。

因此,我们需要将我们的依赖项放在本地文件系统中,然后 maven 将用作中央文件系统的镜像。

我找不到配置 maven 来构建它的方法 - 我正在获取依赖项 - jar + pom 然后使用

要安装罐子:

mvn org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file
-Durl="file:///{repositoryPath}" 
-DrepositoryId="InternalRepo" 
-Dfile="{jarFile}" 
-DpomFile="{pomFile}" 
-DrepositoryLayout=default 
-DgroupId={groupId} 
-DartifactId={artifactId} 
-Dversion={version} 
-Dpackaging=jar
-s "C:/apache-maven-3.3.1/conf/settings_centralRepo.xml"

要安装 Poms:

mvn org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file 
-Durl="file:///{repositoryPath}"
-DrepositoryId="InternalRepo" 
-Dfile="{pomFile}" 
-DpomFile="{pomFile}" 
-DrepositoryLayout=default 
-DgroupId={groupId} 
-DartifactId={artifactId} 
-Dversion={version} 
-Dpackaging=pom
-s "C:/apache-maven-3.3.1/conf/settings_centralRepo.xml"

理想情况下,我们需要一个可以放入父 pom 中的配置,该配置会触发所有依赖项被复制。然而,文档暗示这是用于构建工件而不是依赖项。maven中通常有一种方法,但很难找到。

非常感谢任何帮助 - 我目前已经编写了一个脚本来执行此操作,这既乏味又费力。

4

0 回答 0