gpt4 book ai didi

Maven 去 https ://repo. maven.apache.org/maven2/在编译阶段,即使不同的 repo 被定义为 "central"

转载 作者:行者123 更新时间:2023-12-05 05:05:27 26 4
gpt4 key购买 nike

我有一个 pom,我将不同的 repo 定义为中央(在存储库和 pluginRepositorie 中)但是,当我运行 mvn install 时,我在日志中看到 maven 转到:https://repo.maven.apache.org .

我的pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>Test</artifactId>
<version>1.0-SNAPSHOT</version>

<repositories>
<repository>
<id>central</id>
<name>My-repo</name>
<url>http://My-repo/remote</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>My-repo-release</name>
<url>http://my-repo/plugins-release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>

<pluginRepository>
<id>release</id>
<name>My-repo-snapshot</name>
<url>http://my-repo/plugins-snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>

</pluginRepositories>

<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>22.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.parent.basedir}/plugins</outputDirectory>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>

日志:

Downloaded from central: http://my-repo/plugins-release/commons-codec/commons-codec/1.6/commons-codec-1.6.jar (233 kB at 226 kB/s)
Downloaded from central: http://my-repo/plugins-release/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar (262 kB at 253 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/felix/maven-bundle-plugin/2.5.0/maven-bundle-plugin-2.5.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/felix/maven-bundle-plugin/2.5.0/maven-bundle-plugin-2.5.0.pom (0 B at 0 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/felix/felix-parent/2.1/felix-parent-2.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/felix/felix-parent/2.1/felix-parent-2.1.pom (0 B at 0 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/biz/aQute/bnd/bndlib/2.3.0/bndlib-2.3.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/biz/aQute/bnd/bndlib/2.3.0/bndlib-2.3.0.pom (0 B at 0 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/osgi/org.osgi.core/4.3.1/org.osgi.core-4.3.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/osgi/org.osgi.core/4.3.1/org.osgi.core-4.3.1.pom (0 B at 0 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.pom (0 B at 0 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/osgi/org.osgi.core/4.1.0/org.osgi.core-4.1.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/osgi/org.osgi.core/4.1.0/org.osgi.core-4.1.0.pom (0 B at 0 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/easymock/easymock/2.4/easymock-2.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/easymock/easymock/2.4/easymock-2.4.pom (0 B at 0 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/felix/org.apache.felix.utils/1.6.0/org.apache.felix.utils-1.6.0.pom
Progress (1): 2.2/3.3 kB
Progress (1): 3.3 kB

当我查看我的人工制品 (jfrog) 时,我看到元数据和有时更多的文件(如 source.jar)被定义为“未缓存”。也许它与问题有关?

另外,当我使用Mirrors时,maven没有进入maven-central,但是编译成功通过。

我的 setting.xml 中的镜像:

<mirrors>
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on repo.mycompany.com</name>
<url>http://My-repo/remote</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>

最佳答案

即使你没有将中央仓库添加到你的项目中,你的项目也会从 super pom 中继承中央仓库。您可以通过镜像完全排除中央存储库,您可以阅读更多here .

默认情况下,maven 首先检查本地存储库,然后检查在 setting.xml 中添加的存储库。

此外,我在您的日志中看到的内容暗示 maven 正在下载一些我认为用于运行程序集插件的核心依赖项,我猜您没有这些基本依赖项,因为 maven 从中央 Repo 获取它们。

关于Maven 去 https ://repo. maven.apache.org/maven2/在编译阶段,即使不同的 repo 被定义为 "central",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60520443/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com