每当我执行以下命令时,我都会观察: -
mvn -f pom.xml -Dmaven.repo.local=$MAVEN_REPO -Drat.skip=true -DnoTest=true surefire-report:report
maven正在下载maven-metadata
&每次都有插件工件。
Downloading: http://maven.twttr.com/com/neveda/kekin-storage-metrics/0.001-SNAPSHOT/maven-metadata.xml
...
Downloading: http://artifactory.kekin.local:XXXX/libs-release/org/
我已经通过this回答&我的settings.xml
如下所示: -
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://artifactory.kekin.local:XXXX/libs-release</url>
</repository>
<repository>
<snapshots>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://artifactory.kekin.local:XXXX/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://artifactory.kekin.local:XXXX/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://artifactory.kekin.local:XXXX/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
环境: -
答案 0 :(得分:1)
我不确定这是否适合您,但您可以使用--offline
开关调用maven来阻止它进行任何下载:
mvn --offline -f pom.xml -Dmaven.repo.local=$MAVEN_REPO -Drat.skip=true -DnoTest=true surefire-report:report
但这有副作用,如果缺少任何工件,您的构建将失败。