英文:
How to access more than one repo in maven?
问题
以下是您提供的内容的翻译部分:
原始配置部分:
Can someone clarify for me how I can access more than one repo in maven? I have a corporate mirror that is configured in settings.yml and it takes in all requests The problem is I need a jar file that is not in the mirror? If I switch it I lose all the other jars I need? Can someone explain what I need to do? If I add additional mirrors it only uses one of them at a time ... Every time I compile mvn clean install it just checks the one mirror and complains.
<mirrors>
<mirror> <!--将所有请求发送到公共组-->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://sl- quality.mycompany.com/nexus/content/groups/public/</url>
<name>UK Central</name>
<url>http://uk.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror> <!--将所有请求发送到公共组-->
<id>ksqlDB</id>
<mirrorOf>*</mirrorOf>
<url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
</mirror>
<mirror> <!--将所有请求发送到公共组-->
<id>confluent</id>
<mirrorOf>*</mirrorOf>
<url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
</mirror>
</mirrors>
<activeProfiles>
<!--使配置一直处于活动状态-->
<activeProfile>nexus</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
更新后的配置部分:
<mirrors>
<mirror> <!--将所有请求发送到公共组-->
<id>nexus</id>
<mirrorOf>!ksqlDB, !confluent, *</mirrorOf>
<url>http://sl-quality.mycompany.com/etc</url>
</mirror>
<mirror> <!--将所有请求发送到公共组-->
<id>ksqlDB</id>
<mirrorOf>!nexus,*</mirrorOf>
<url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
</mirror>
<mirror> <!--将所有请求发送到公共组-->
<id>confluent</id>
<mirrorOf>!nexus, !ksqlDB, *</mirrorOf>
<url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
</mirror>
</mirrors>
pom.xml
<repositories>
<!-- jhipster-needle-maven-repository -->
<repository>
<id>ksqlDB</id>
<name>ksqlDB</name>
<url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
</repository>
<repository>
<id>confluent</id>
<name>Confluent</name>
<url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
</repository>
</repositories>
<pluginRepositories>
<!-- jhipster-needle-maven-plugin-repository -->
<pluginRepository>
<id>ksqlDB</id>
<url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
</pluginRepository>
<pluginRepository>
<id>confluent</id>
<url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
</pluginRepository>
</pluginRepositories>
<ksqldb.version>0.11.0</ksqldb.version>
<!-- 用于编译的 Maven 属性 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
以上为翻译的内容,仅包含代码和配置部分。
英文:
Can someone clarify for me how I can access more than one repo in maven? I have a corporate mirror that is configured in settings.yml and it takes in all requests The problem is I need a jar file that is not in the mirror? If I switch it I lose all the other jars I need? Can someone explain what I need to do? If I add additional mirrors it only uses one of them at a time ... Every time I compile mvn clean install it just checks the one mirror and complains.
<mirrors>
<mirror> <!--Send all requests to the public group -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://sl- quality.mycompany.com/nexus/content/groups/public/</url>
<name>UK Central</name>
<url>http://uk.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>-->
</mirror>
<mirror> <!--Send all requests to the public group -->
<id>ksqlDB</id>
<mirrorOf>*</mirrorOf>
<url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
</mirror>
<mirror> <!--Send all requests to the public group -->
<id>confluent</id>
<mirrorOf>*</mirrorOf>
<url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
</mirror>
</mirrors>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
UPDATE:
<mirrors>
<mirror> <!--Send all requests to the public group -->
<id>nexus</id>
<mirrorOf>!ksqlDB, !confluent, *</mirrorOf>
<url>http://sl-quality.mycompany.com/etc</url>
<!--<id>UK</id>
<name>UK Central</name>
<url>http://uk.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>-->
</mirror>
<mirror> <!--Send all requests to the public group -->
<id>ksqlDB</id>
<mirrorOf>!nexus,*</mirrorOf>
<url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
</mirror>
<mirror> <!--Send all requests to the public group -->
<id>confluent</id>
<mirrorOf>!nexus, !ksqlDB, *</mirrorOf>
<url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
</mirror>
</mirrors>
pom.xml
<repositories>
<!-- jhipster-needle-maven-repository -->
<repository>
<id>ksqlDB</id>
<name>ksqlDB</name>
<url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
</repository>
<repository>
<id>confluent</id>
<name>Confluent</name>
<url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
</repository>
</repositories>
<pluginRepositories>
<!-- jhipster-needle-maven-plugin-repository -->
<pluginRepository>
<id>ksqlDB</id>
<url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
</pluginRepository>
<pluginRepository>
<id>confluent</id>
<url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
</pluginRepository>
</pluginRepositories>
<ksqldb.version>0.11.0</ksqldb.version>
<!-- Maven properties for compilation -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
// This is all to get just
<dependency>
<groupId>io.confluent.ksql</groupId>
<artifactId>ksqldb-api-client</artifactId>
<version>${ksqldb.version}</version>
</dependency>
答案1
得分: 1
因为您已经指定了这些内容是一切的镜像。
<mirrorOf>*</mirrorOf>
您不应该有3个都是一切的镜像。这没有任何意义。
您应该使用一些排除项。在这种情况下,这意味着“除了someRepo
之外的所有内容”。
<mirrorOf>*,!someRepo</mirrorOf>
请参阅镜像设置指南。
英文:
It's because you've specified these things are a mirror of everything.
<mirrorOf>*</mirrorOf>
You shouldn't have 3 mirrors which are all a mirror of everything. That doesn't make any sense.
You should make use of some exclusions. In this case, this means "everything except someRepo
".
<mirrorOf>*,!someRepo</mirrorOf>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论