【问题标题】:How to access more than one repo in maven?如何在 Maven 中访问多个 repo?
【发布时间】:2020-12-21 14:43:05
【问题描述】:

有人可以为我澄清一下如何在 maven 中访问多个 repo 吗?我有一个在 settings.yml 中配置的公司镜像,它接受所有请求问题是我需要一个不在镜像中的 jar 文件?如果我切换它,我会丢失我需要的所有其他罐子吗?有人可以解释我需要做什么吗?如果我添加额外的镜像,它一次只使用其中一个...每次我编译 mvn clean install 它只检查一个镜像并抱怨。

<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>

更新:

<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>

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>

// 这就是全部了

<dependency>
      <groupId>io.confluent.ksql</groupId>
      <artifactId>ksqldb-api-client</artifactId>
       <version>${ksqldb.version}</version>
</dependency>

【问题讨论】:

标签: java spring-boot maven pom.xml


【解决方案1】:

因为你已经指定这些东西是一切的镜子。

<mirrorOf>*</mirrorOf>

你不应该有 3 面镜子,它们都是一切事物的镜子。这没有任何意义。

您应该使用一些排除项。在这种情况下,这意味着“除了someRepo 之外的所有内容”。

<mirrorOf>*,!someRepo</mirrorOf>

Guide to Mirror Settings

【讨论】:

  • 现在我得到插件 org.apache.maven.plugins:maven-clean-plugin:2.5 或者它的依赖项之一无法解决:Failure to find org.apache.maven.plugins:maven -clean-plugin:jar:2.5 in ksqldb-maven.s3.amazonaws.com/maven 被缓存在本地仓库中,直到 ksqlDB 的更新间隔已过或强制更新后才会重新尝试解析 -> [帮助 1]
  • @RogerAlkins 当我不知道你改变了什么时,你希望我如何解决你的问题?
  • nexus 下似乎有很多 repos ... 我需要在我的其他镜像中排除每个 repos 吗?
  • @Micheal 所以现在你知道我改变了什么
猜你喜欢
  • 2020-05-02
  • 2022-07-28
  • 1970-01-01
  • 2022-06-13
  • 2023-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多