Maven 错误地使用 SNAPSHOT 私人仓库在 AWS 上构建
Maven build on AWS wrongly using SNAPSHOT private repo
我们有一个私人 Maven 仓库(人工制品),我们在 libs-release 文件夹中有一个发布 jar (cryptolib-0.9.7.jar)。
在本地或在 Jenkins(托管在 Azure 上)上构建,一切正常。基于 AWS 上的代码构建,maven 尝试(但失败)改为从 libs-snapshot 下载。
Jenkins 和本地输出 (v3.3.9)...
下载:http://[our-repo]/artifactory/libs-release/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.pom
下载:http://[our-repo]/artifactory/libs-release/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.pom(457 B 在 3.7 KB/sec)
下载:http://[our-repo]/artifactory/libs-release/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.jar
下载地址:http://[our-repo]/artifactory/libs-release/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.jar(13 KB at 234.8 KB/sec)
AWS/CodeBuild 输出 (v.3.3.3)...
下载:http://[our-repo]/artifactory/libs-snapshot/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.jar
两者都在执行 mvn -B install
。我尝试了各种在线建议,pom 存储库部分目前看起来像这样(现在似乎只尝试从中央下载)...
<repositories>
<repository>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://[our-repo]/artifactory/libs-snapshot</url>
</repository>
<repository>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://[our-repo]/artifactory/libs-release</url>
</repository>
</repositories>
我还缺什么(除了头发!!!)??
呸! "When you use Maven with an AWS CodeBuild provided Java build environment, Maven pulls build and plugin dependencies from the secure central Maven repository at repo1.maven.org/maven2. This happens even if your build project's pom.xml file explicitly declares other locations to use instead."http://docs.aws.amazon.com/codebuild/latest/userguide/troubleshooting.html#troubleshooting-maven-repos
我的解决方案是在构建规范安装阶段删除默认 settings.xml。
phases:
install:
commands:
- rm /root/.m2/settings.xml
我们有一个私人 Maven 仓库(人工制品),我们在 libs-release 文件夹中有一个发布 jar (cryptolib-0.9.7.jar)。
在本地或在 Jenkins(托管在 Azure 上)上构建,一切正常。基于 AWS 上的代码构建,maven 尝试(但失败)改为从 libs-snapshot 下载。
Jenkins 和本地输出 (v3.3.9)...
下载:http://[our-repo]/artifactory/libs-release/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.pom 下载:http://[our-repo]/artifactory/libs-release/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.pom(457 B 在 3.7 KB/sec) 下载:http://[our-repo]/artifactory/libs-release/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.jar 下载地址:http://[our-repo]/artifactory/libs-release/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.jar(13 KB at 234.8 KB/sec)
AWS/CodeBuild 输出 (v.3.3.3)...
下载:http://[our-repo]/artifactory/libs-snapshot/org/openpseudonymiser/cryptolib/0.9.7/cryptolib-0.9.7.jar
两者都在执行 mvn -B install
。我尝试了各种在线建议,pom 存储库部分目前看起来像这样(现在似乎只尝试从中央下载)...
<repositories>
<repository>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://[our-repo]/artifactory/libs-snapshot</url>
</repository>
<repository>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://[our-repo]/artifactory/libs-release</url>
</repository>
</repositories>
我还缺什么(除了头发!!!)??
呸! "When you use Maven with an AWS CodeBuild provided Java build environment, Maven pulls build and plugin dependencies from the secure central Maven repository at repo1.maven.org/maven2. This happens even if your build project's pom.xml file explicitly declares other locations to use instead."http://docs.aws.amazon.com/codebuild/latest/userguide/troubleshooting.html#troubleshooting-maven-repos
我的解决方案是在构建规范安装阶段删除默认 settings.xml。
phases:
install:
commands:
- rm /root/.m2/settings.xml