将maven 3.0.3升级到最新可用的3.9.9版本(java-8支持版本)

问题描述 投票:0回答:1

我正在尝试将项目中的maven版本从3.0.3升级到maven 3.9.9

该项目有自己的私有存储库,它尝试从其中解析依赖项,解析依赖项的 maven 命令会在仅解析少数依赖项时抛出错误

mvn -U -f /home/example-pom.xml -s /home/settings.xml dependency:resolve -Djdk.http.auth.tunneling.disabledSchemes=""

example-pom.xml 由各种子模块组成,如下所示

<?xml version="1.0" encoding="UTF-8"?><project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.project-example</groupId>
  <artifactId>examples</artifactId>
  <name>examples</name>
  <description>example pom</description>
  <packaging>pom</packaging>
  <parent>
    <groupId>com.project-example</groupId>
    <artifactId>example-base</artifactId>
    <version>24.3.25.0.2-SNAPSHOT</version>
  </parent>
  <repositories>
    <repository>
      <id>central</id>
      <url>https://private-repository.com/mavenrepo/24.3.25.0.2/repository</url>
      <releases>
        <updatePolicy>always</updatePolicy>
      </releases>
      <snapshots>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>https://private-repository.com/mavenrepo/24.3.25.0.2/repository</url>
    </pluginRepository>
  </pluginRepositories>
  <dependencies>
    <dependency>
    <groupId>com.project-example</groupId>
      <artifactId>example-subproject1</artifactId>
      <version>24.3.25.0.2-SNAPSHOT</version>
    </dependency>
  </dependencies>
<project>

其中一个子模块包含依赖项 org.infinispan:infinispan-core:jar:9.3.0.Final

  • settings.xml 文件如下所示
<settings>
    <interactiveMode>false</interactiveMode>
    <localRepository>/usr/local/examples/mavenrepo</localRepository>
    <proxies>
        <proxy>
            <active>false</active>
            <protocol>https</protocol>
            <username/>
            <password/>
            <port>80</port>
            <host>127.0.0.1</host>
        </proxy>
    </proxies>
    <servers>
        <server>
            <id>central</id>
            <configuration>
                <httpHeaders>
                    <property>
                        <name>Authorization</name>
                        <value>Basic xxxx</value>
                    </property>
                </httpHeaders>
            </configuration>
        </server>
    </servers>
    <mirrors/>
    <profiles/>
</settings>

它不是通过私有存储库解析,而是转到在系统环境中被阻止的 Maven 中心,因此会引发以下构建错误

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /usr/local/maven
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:resolve on project examples: Could not collect dependencies for project com.project-example:examples:pom:24.3.25.0.2-SNAPSHOT
Failed to read artifact descriptor for org.infinispan:infinispan-core:jar:9.3.0.Final
Caused by: The following artifacts could not be resolved: io.netty:netty-bom:pom:4.1.22.Final (absent): Could not transfer artifact io.netty:netty-bom:pom:4.1.22.Final from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: java.security.cert.CertPathBuilderException: Could not build a validated path

但是,当我尝试进一步调试并从 mavenrepo 手动删除 netty-bom 依赖项,并运行下面的 dependency:get 命令时

mvn -U -X -f /home/example-pom.xml -s /home/settings.xml dependency:get -DgroupId=io.netty -DartifactId=netty-bom -Dversion=4.1.22.Final -Dpackaging=pom -Djdk.http.auth.tunneling.disabledSchemes=""

它成功解决了远程存储库的依赖关系

但是,当删除 infinispan 依赖项并运行 dependency:get 命令时,它给出了以下调试跟踪

mvn -U -X -f /home/example-pom.xml -s /home/settings.xml dependency:get -DgroupId=org.infinispan -DartifactId=infinispan-core -Dversion=9.3.0.Final -Djdk.http.auth.tunneling.disabledSchemes=""


[INFO] Downloading from central: https://private-repository.com/mavenrepo/24.3.25.0.2/repositoryorg/infinispan/infinispan-core/9.3.0.Final/infinispan-core-9.3.0.Final.pom
[INFO] Downloaded from central: https://private-repository.com/mavenrepo/24.3.25.0.2/repositoryorg/infinispan/infinispan-core/9.3.0.Final/infinispan-core-9.3.0.Final.pom (9.9 kB at 194 kB/s)
[DEBUG] Writing tracking file '/usr/local/examples/mavenrepo/org/infinispan/infinispan-core/9.3.0.Final/_remote.repositories'
[DEBUG] Writing tracking file '/usr/local/examples/mavenrepo/org/infinispan/infinispan-core/9.3.0.Final/infinispan-core-9.3.0.Final.pom.lastUpdated'
[DEBUG] Resolving artifact org.infinispan:infinispan-bom:pom:9.3.0.Final from [central (https://private-repository.com/mavenrepo/24.3.25.0.2/repository, default, releases+snapshots)]
[DEBUG] Resolving artifact org.infinispan:infinispan-bom:pom:9.3.0.Final from [central (https://private-repository.com/mavenrepo/24.3.25.0.2/repository, default, releases+snapshots)]
[DEBUG] Using transporter HttpTransporter with priority 5.0 for https://private-repository.com/mavenrepo/24.3.25.0.2/repository
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://private-repository.com/mavenrepo/24.3.25.0.2/repository
[INFO] Downloading from central: https://private-repository.com/mavenrepo/24.3.25.0.2/repositoryorg/infinispan/infinispan-bom/9.3.0.Final/infinispan-bom-9.3.0.Final.pom
[INFO] Downloaded from central: https://private-repository.com/mavenrepo/24.3.25.0.2/repositoryorg/infinispan/infinispan-bom/9.3.0.Final/infinispan-bom-9.3.0.Final.pom (33 kB at 456 kB/s)
[DEBUG] Writing tracking file '/usr/local/examples/mavenrepo/org/infinispan/infinispan-bom/9.3.0.Final/_remote.repositories'
[DEBUG] Writing tracking file '/usr/local/examples/mavenrepo/org/infinispan/infinispan-bom/9.3.0.Final/infinispan-bom-9.3.0.Final.pom.lastUpdated'
[DEBUG] Resolving artifact io.netty:netty-bom:pom:4.1.22.Final from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Resolving artifact io.netty:netty-bom:pom:4.1.22.Final from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Using transporter HttpTransporter with priority 5.0 for https://repo.maven.apache.org/maven2
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/io/netty/netty-bom/4.1.22.Final/netty-bom-4.1.22.Final.pom
[DEBUG] Writing tracking file '/usr/local/examples/mavenrepo/io/netty/netty-bom/4.1.22.Final/netty-bom-4.1.22.Final.pom.lastUpdated'
[DEBUG] Resolving artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Resolving artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Using transporter HttpTransporter with priority 5.0 for https://repo.maven.apache.org/maven2
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/jboss/shrinkwrap/shrinkwrap-bom/1.2.6/shrinkwrap-bom-1.2.6.pom
[DEBUG] Writing tracking file '/usr/local/examples/mavenrepo/org/jboss/shrinkwrap/shrinkwrap-bom/1.2.6/shrinkwrap-bom-1.2.6.pom.lastUpdated'
[DEBUG] Resolving artifact org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Resolving artifact org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Using transporter HttpTransporter with priority 5.0 for https://repo.maven.apache.org/maven2
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-bom/2.0.0-alpha-10/shrinkwrap-descriptors-bom-2.0.0-alpha-10.pom
[DEBUG] Writing tracking file '/usr/local/examples/mavenrepo/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-bom/2.0.0-alpha-10/shrinkwrap-descriptors-bom-2.0.0-alpha-10.pom.lastUpdated'
[DEBUG] Resolving artifact io.netty:netty-bom:pom:4.1.22.Final from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Resolving artifact io.netty:netty-bom:pom:4.1.22.Final from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Skipped remote request for io.netty:netty-bom:pom:4.1.22.Final, already updated during this session
[DEBUG] Resolving artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Resolving artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Skipped remote request for org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6, already updated during this session
[DEBUG] Resolving artifact org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Resolving artifact org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 from [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Skipped remote request for org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10, already updated during this session
[WARNING] Failed to build parent project for org.infinispan:infinispan-core:bundle:9.3.0.Final
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: The following artifacts could not be resolved: io.netty:netty-bom:pom:4.1.22.Final (absent): io.netty:netty-bom:pom:4.1.22.Final failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact io.netty:netty-bom:pom:4.1.22.Final from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: java.security.cert.CertPathBuilderException: Could not build a validated path. @ org.infinispan:infinispan-bom:9.3.0.Final, /usr/local/examples/mavenrepo/org/infinispan/infinispan-bom/9.3.0.Final/infinispan-bom-9.3.0.Final.pom, line 754, column 22
[ERROR] Non-resolvable import POM: The following artifacts could not be resolved: org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 (absent): org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: java.security.cert.CertPathBuilderException: Could not build a validated path. @ org.jboss.arquillian:arquillian-bom:1.1.13.Final, /usr/local/examples/mavenrepo/org/jboss/arquillian/arquillian-bom/1.1.13.Final/arquillian-bom-1.1.13.Final.pom, line 206, column 25
[ERROR] Non-resolvable import POM: The following artifacts could not be resolved: org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 (absent): org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: java.security.cert.CertPathBuilderException: Could not build a validated path. @ org.jboss.arquillian:arquillian-bom:1.1.13.Final, /usr/local/examples/mavenrepo/org/jboss/arquillian/arquillian-bom/1.1.13.Final/arquillian-bom-1.1.13.Final.pom, line 224, column 25 at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:208)


Caused by: org.apache.maven.model.building.ModelBuildingException: 3 problems were encountered while building the effective model for org.infinispan:infinispan-parent:9.3.0.Final
[ERROR] Non-resolvable import POM: The following artifacts could not be resolved: io.netty:netty-bom:pom:4.1.22.Final (absent): io.netty:netty-bom:pom:4.1.22.Final failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact io.netty:netty-bom:pom:4.1.22.Final from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: java.security.cert.CertPathBuilderException: Could not build a validated path. @ org.infinispan:infinispan-bom:9.3.0.Final, /usr/local/examples/mavenrepo/org/infinispan/infinispan-bom/9.3.0.Final/infinispan-bom-9.3.0.Final.pom, line 754, column 22
[ERROR] Non-resolvable import POM: The following artifacts could not be resolved: org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 (absent): org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.6 from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: java.security.cert.CertPathBuilderException: Could not build a validated path. @ org.jboss.arquillian:arquillian-bom:1.1.13.Final, /usr/local/examples/mavenrepo/org/jboss/arquillian/arquillian-bom/1.1.13.Final/arquillian-bom-1.1.13.Final.pom, line 206, column 25
[ERROR] Non-resolvable import POM: The following artifacts could not be resolved: org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 (absent): org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-bom:pom:2.0.0-alpha-10 from/to central (https://repo.maven.apache.org/maven2): PKIX path building failed: java.security.cert.CertPathBuilderException: Could not build a validated path. @ org.jboss.arquillian:arquillian-bom:1.1.13.Final, /usr/local/examples/mavenrepo/org/jboss/arquillian/arquillian-bom/1.1.13.Final/arquillian-bom-1.1.13.Final.pom, line 224, column 25

如果我们在上面的堆栈跟踪中注意到,它成功地从私有存储库下载了 infinispan-bom 和 infinispan-core pom 文件,但对于 netty-bom 来说,它直接进入中央存储库,最终导致 PKIX 路径构建失败错误,因为不允许访问mavencentral

[INFO] Downloading from central: https://repo.maven.apache.org/maven2/io/netty/netty-bom/4.1.22.Final/netty-bom-4.1.22.Final.pom

依赖插件版本:org.apache.maven.plugins:maven-dependency-plugin:2.8

Java版本:1.8.0_292

我在这里遗漏了什么吗?寻求帮助来解决此问题。

谢谢。

java maven maven-3 maven-plugin
1个回答
0
投票

Maven 3.1+ 版本不支持 Java 8,而您似乎正在运行该版本。

要更新到最新版本的 Maven,请确保升级应用程序以使用最新版本的 java。

https://maven.apache.org/developers/compatibility-plan.html

© www.soinside.com 2019 - 2024. All rights reserved.