马文去https://repo.maven.apache.org/maven2/ 在编译阶段,甚至不同的回购协议也被定义为;中环;
我有一个pom,我将不同的repo定义为中心(在存储库和pluginRepositorie中),然而,当我运行mvn安装时,我在maven访问的日志中看到: 我的pom:马文去https://repo.maven.apache.org/maven2/ 在编译阶段,甚至不同的回购协议也被定义为;中环;,maven,pom.xml,maven-assembly-plugin,mirror,jfrog-mission-control,Maven,Pom.xml,Maven Assembly Plugin,Mirror,Jfrog Mission Control,我有一个pom,我将不同的repo定义为中心(在存储库和pluginRepositorie中),然而,当我运行mvn安装时,我在maven访问的日志中看到: 我的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"
<?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>
当我查看我的artifactory(jfrog)时,我看到元数据和更多文件(比如source.jar)被定义为“未缓存”。也许与这个问题有关
另外,当我使用镜像时,maven没有转到maven central,但编译成功通过
my 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>
内部存储库
在repo.mycompany.com上运行的Maven存储库管理器
http://My-repo/remote
中心的
即使您尚未将中央存储库添加到项目中,您的项目也会从super pom继承中央存储库。您可以通过镜像完全排除中央存储库,您可以阅读更多内容
默认情况下,maven首先检查本地存储库,然后在setting.xml中检查添加的存储库
此外,我在您的日志中看到的情况表明,maven正在下载一些我认为用于运行assembly plugin的核心依赖项,我猜您没有这些基本依赖项,因为maven从central Repo获得它们。这里的问题是id标记“central”中给出的名称
马文中心酒店
我的回购协议
http://My-repo/remote
真的
真的
马文中心酒店
我的回购协议解除
http://my-repo/plugins-release
假的
释放
我的回购快照
http://my-repo/plugins-snapshot
假的
这里是(在这里搜索单词“central”)。在某一点上,它说“central”指向maven central存储库。())
因此,如果id指向某个自定义存储库,则解决方案是不要在id中使用“中心”字。例如-您的nexus存储库等。因此,即使我将不同的回购协议定义为central,如果缺少依赖项,maven会转到maven central吗?因为这并不是一直都会发生,当我添加一个新的依赖项(或新版本)时,我的artifactory中没有这个依赖项,完成失败(并且它不会转到maven central)。另外,当我使用mirror时,并发症在没有去maven central的情况下顺利通过。这意味着我的人工制品工厂中确实有这些人工制品,那么为什么要去maven central呢?
<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>
<repositories>
<repository>
<id>maven-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>maven-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>