Maven-下载依赖项时,Maven跳过了一些在设置中定义的服务器。xml

发布于 2025-02-12 08:06:04 字数 13763 浏览 0 评论 0原文

我在使用MVN CLEAN INSTALL -U -X时无法解析依赖项,即使我指定-pcentral配置文件,其中包括具有该依赖关系的存储库。根本原因例外是:

Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.brand.esb:common:pom:0.10 in artifactory-redhat-ga (https://artifactory.example.com/artifactory/redhat-ga)

我看到这种依赖性在artifactory-foo阶段中,这是在我的〜/.m2/settings.xml

Downloading from artifactory-foo-release: https://artifactory.example.com/artifactory/release/com/example/brand/product/test/jms-client/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repository.apache.org/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repository.apache.org/snapshots
Downloading from apache.snapshots: https://repository.apache.org/snapshots/com/example/brand/product/test/jms-client/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Writing tracking file /home/myself/.m2/repository/com/example/brand/product/test/jms-client/0.0.1-SNAPSHOT/resolver-status.properties
[DEBUG] Writing tracking file /home/myself/.m2/repository/com/example/brand/product/test/jms-client/0.0.1-SNAPSHOT/resolver-status.properties
[DEBUG] Could not find metadata com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml in artifactory-foo-release (https://artifactory.example.com/artifactory/release)
[DEBUG] Could not find metadata com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml in apache.snapshots (https://repository.apache.org/snapshots)
[DEBUG] Skipped remote request for com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml, already updated during this session.
[DEBUG] Failure to find com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml in https://artifactory.example.com/artifactory/release was cached in the local repository, resolution will not be reattempted until the update interval of artifactory-foo-release has elapsed or updates are forced
[DEBUG] Skipped remote request for com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml, already updated during this session.
[DEBUG] Failure to find com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml in https://repository.apache.org/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced
[DEBUG] Verifying availability of /home/myself/.m2/repository/com/brand/esb/common/0.10/common-0.10.pom from [central (https://repo.maven.apache.org/maven2, default, disabled), artifactory-redhat-ga (https://artifactory.example.com/artifactory/redhat-ga, default, releases), artifactory-foo-release (https://artifactory.example.com/artifactory/release, default, releases+snapshots), apache.snapshots (https://repository.apache.org/snapshots, default, snapshots)]
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://artifactory.example.com/artifactory/redhat-ga
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://artifactory.example.com/artifactory/redhat-ga
Downloading from artifactory-redhat-ga: https://artifactory.example.com/artifactory/redhat-ga/com/brand/esb/common/0.10/common-0.10.pom
[DEBUG] Writing tracking file /home/myself/.m2/repository/com/brand/esb/common/0.10/common-0.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://artifactory.example.com/artifactory/release
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://artifactory.example.com/artifactory/release with username=myself, password=***
Downloading from artifactory-foo-release: https://artifactory.example.com/artifactory/release/com/brand/esb/common/0.10/common-0.10.pom
[DEBUG] Writing tracking file /home/myself/.m2/repository/com/brand/esb/common/0.10/common-0.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://artifactory.example.com/artifactory/release
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repository.apache.org/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://artifactory.example.com/artifactory/release with username=myself, password=***
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repository.apache.org/snapshots

设置:

<settings>
    <!-- if you need http connection, enable it and don't block -->
    <mirrors>
        <mirror>
          <id>maven-default-http-blocker</id>
          <mirrorOf>external:http:*</mirrorOf>
          <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
          <url>file:/home/myself/.m2/repository/</url>
          <blocked>false</blocked>
        </mirror>
    </mirrors>
    <servers>
        <server>
            <id>artifactory-redhat-ga</id>
        </server>
        <server>
            <id>artifactory-foo-release</id>
            <username>myself</username>
            <password>{encoded}</password>
        </server>
        <server>
            <id>artifactory-foo-staging</id>
            <username>myself</username>
            <password>{encoded}</password>
        </server>
        <server>
            <id>artifactory-foo-external</id>
            <username>myself</username>
            <password>{encoded}</password>
        </server>
        <server>
            <id>artifactory-foo-dev</id>
            <username>myself</username>
            <password>{encoded}</password>
        </server>
    </servers>
    <profiles>
        <profile>
            <id>confluent</id>
            <repositories>
                <repository>
                    <id>confluent</id>
                    <url>http://packages.confluent.io/maven/</url>
                </repository>
            </repositories>
        </profile>
        <profile>
            <id>central</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>central</id>
                    <url>https://repo.maven.apache.org/maven2</url>
                    <releases>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-redhat-ga</id>
                    <url>https://artifactory.example.com/artifactory/redhat-ga</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-foo-release</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-release</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-foo-staging</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-staging</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-foo-external</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-external</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-foo-dev</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-dev</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
        <repository>
            <id>elasticsearch-releases</id>
            <url>https://artifacts.elastic.co/maven</url>
             <releases>
                <enabled>true</enabled>
             </releases>
             <snapshots>
                <enabled>false</enabled>
             </snapshots>
          </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>central</id>
                    <url>https://repo.maven.apache.org/maven2</url>
                    <releases>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </pluginRepository>
                <pluginRepository>
                    <id>artifactory-redhat-ga</id>
                    <url>https://artifactory.example.com/artifactory/redhat-ga</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </pluginRepository>
                <pluginRepository>
                    <id>artifactory-foo-release</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-release</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <sonar.host.url>
                    https://sonarqube.bar.example.com
                </sonar.host.url>
            </properties>
        </profile>
    </profiles>
    <pluginGroups>
        <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
    </pluginGroups>
</settings>

你知道为什么吗?

实际上,外部和开发存储库也会跳过。如何检查settings.xml中定义的所有存储库?

I cannot resolve my dependencies while using mvn clean install -U -X, even when I specify -Pcentral profile which includes the repository which has that dependency. The root cause exception is:

Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.brand.esb:common:pom:0.10 in artifactory-redhat-ga (https://artifactory.example.com/artifactory/redhat-ga)

I see this dependency is in artifactory-foo-staging, and this is defined in my ~/.m2/settings.xml, but I don't see Maven downloading from it. The credentials are good, verified with private mode.

Downloading from artifactory-foo-release: https://artifactory.example.com/artifactory/release/com/example/brand/product/test/jms-client/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repository.apache.org/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repository.apache.org/snapshots
Downloading from apache.snapshots: https://repository.apache.org/snapshots/com/example/brand/product/test/jms-client/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Writing tracking file /home/myself/.m2/repository/com/example/brand/product/test/jms-client/0.0.1-SNAPSHOT/resolver-status.properties
[DEBUG] Writing tracking file /home/myself/.m2/repository/com/example/brand/product/test/jms-client/0.0.1-SNAPSHOT/resolver-status.properties
[DEBUG] Could not find metadata com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml in artifactory-foo-release (https://artifactory.example.com/artifactory/release)
[DEBUG] Could not find metadata com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml in apache.snapshots (https://repository.apache.org/snapshots)
[DEBUG] Skipped remote request for com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml, already updated during this session.
[DEBUG] Failure to find com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml in https://artifactory.example.com/artifactory/release was cached in the local repository, resolution will not be reattempted until the update interval of artifactory-foo-release has elapsed or updates are forced
[DEBUG] Skipped remote request for com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml, already updated during this session.
[DEBUG] Failure to find com.example.brand.product.test:jms-client:0.0.1-SNAPSHOT/maven-metadata.xml in https://repository.apache.org/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced
[DEBUG] Verifying availability of /home/myself/.m2/repository/com/brand/esb/common/0.10/common-0.10.pom from [central (https://repo.maven.apache.org/maven2, default, disabled), artifactory-redhat-ga (https://artifactory.example.com/artifactory/redhat-ga, default, releases), artifactory-foo-release (https://artifactory.example.com/artifactory/release, default, releases+snapshots), apache.snapshots (https://repository.apache.org/snapshots, default, snapshots)]
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://artifactory.example.com/artifactory/redhat-ga
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://artifactory.example.com/artifactory/redhat-ga
Downloading from artifactory-redhat-ga: https://artifactory.example.com/artifactory/redhat-ga/com/brand/esb/common/0.10/common-0.10.pom
[DEBUG] Writing tracking file /home/myself/.m2/repository/com/brand/esb/common/0.10/common-0.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://artifactory.example.com/artifactory/release
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://artifactory.example.com/artifactory/release with username=myself, password=***
Downloading from artifactory-foo-release: https://artifactory.example.com/artifactory/release/com/brand/esb/common/0.10/common-0.10.pom
[DEBUG] Writing tracking file /home/myself/.m2/repository/com/brand/esb/common/0.10/common-0.10.pom.lastUpdated
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://artifactory.example.com/artifactory/release
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repository.apache.org/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://artifactory.example.com/artifactory/release with username=myself, password=***
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repository.apache.org/snapshots

The settings:

<settings>
    <!-- if you need http connection, enable it and don't block -->
    <mirrors>
        <mirror>
          <id>maven-default-http-blocker</id>
          <mirrorOf>external:http:*</mirrorOf>
          <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
          <url>file:/home/myself/.m2/repository/</url>
          <blocked>false</blocked>
        </mirror>
    </mirrors>
    <servers>
        <server>
            <id>artifactory-redhat-ga</id>
        </server>
        <server>
            <id>artifactory-foo-release</id>
            <username>myself</username>
            <password>{encoded}</password>
        </server>
        <server>
            <id>artifactory-foo-staging</id>
            <username>myself</username>
            <password>{encoded}</password>
        </server>
        <server>
            <id>artifactory-foo-external</id>
            <username>myself</username>
            <password>{encoded}</password>
        </server>
        <server>
            <id>artifactory-foo-dev</id>
            <username>myself</username>
            <password>{encoded}</password>
        </server>
    </servers>
    <profiles>
        <profile>
            <id>confluent</id>
            <repositories>
                <repository>
                    <id>confluent</id>
                    <url>http://packages.confluent.io/maven/</url>
                </repository>
            </repositories>
        </profile>
        <profile>
            <id>central</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>central</id>
                    <url>https://repo.maven.apache.org/maven2</url>
                    <releases>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-redhat-ga</id>
                    <url>https://artifactory.example.com/artifactory/redhat-ga</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-foo-release</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-release</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-foo-staging</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-staging</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-foo-external</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-external</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
                <repository>
                    <id>artifactory-foo-dev</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-dev</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </repository>
        <repository>
            <id>elasticsearch-releases</id>
            <url>https://artifacts.elastic.co/maven</url>
             <releases>
                <enabled>true</enabled>
             </releases>
             <snapshots>
                <enabled>false</enabled>
             </snapshots>
          </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>central</id>
                    <url>https://repo.maven.apache.org/maven2</url>
                    <releases>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </pluginRepository>
                <pluginRepository>
                    <id>artifactory-redhat-ga</id>
                    <url>https://artifactory.example.com/artifactory/redhat-ga</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </pluginRepository>
                <pluginRepository>
                    <id>artifactory-foo-release</id>
                    <url>https://artifactory.example.com/artifactory/proj-foo-release</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <sonar.host.url>
                    https://sonarqube.bar.example.com
                </sonar.host.url>
            </properties>
        </profile>
    </profiles>
    <pluginGroups>
        <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
    </pluginGroups>
</settings>

Do you know why?

Actually external and dev repos are also skipped. How to check all the repos defined in settings.xml?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

染火枫林 2025-02-19 08:06:04

好吧,按照Maven的命名模式,我手动将POM/JARS手动下载到本地存储库路径中时开始工作。仍然不了解,但是我本地的.m2回购可以现在解决。

有一个pom/jar,但不知何故它不起作用,所以我将其删除。我还必须删除xxx.pom.lastupdatedxxx.pom.sha1_Remote.Remote.RepoSitories files。

Well, things start to work when I manually download the pom/jars into my local repository paths, following the convention of naming patterns of Maven. Still not understanding but my local .m2 repo can resolve them now.

There was a pom/jar but somehow it does not work so I removed it. I also had to remove the xxx.pom.lastUpdated, xxx.pom.sha1, and _remote.repositories files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文