java 我的PC上的2个eclipse示例之一给出:无法读取com.google的工件描述符,guava:guava:jar

ql3eal8s  于 2022-12-25  发布在  Java
关注(0)|答案(1)|浏览(141)

我有2个eclipse示例,相同的POM依赖项在其中一个eclipse示例中导致了这个错误:

org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.google.guava:guava:jar:31.1.0.redhat-00001
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:329)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:198)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:535)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:519)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.doRecurse(DefaultDependencyCollector.java:504)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:458)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.doRecurse(DefaultDependencyCollector.java:504)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:458)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351)
    at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316)
    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:172)
    at org.apache.maven.project.DefaultProjectBuilder.resolveDependencies(DefaultProjectBuilder.java:215)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:188)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:119)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.readMavenProject(MavenImpl.java:636)
    at org.eclipse.m2e.core.internal.project.registry.DefaultMavenDependencyResolver.resolveProjectDependencies(DefaultMavenDependencyResolver.java:63)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refreshPhase2(ProjectRegistryManager.java:530)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager$3.call(ProjectRegistryManager.java:492)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager$3.call(ProjectRegistryManager.java:1)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:496)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:351)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:298)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.getProjectFacade(MavenBuilder.java:154)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:89)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Failure to find com.google.guava:guava-parent:pom:31.1.0.redhat-00001 in https://nexus.akbankpreprod.com/repository/maven-public-int/ was cached in the local repository, resolution will not be reattempted until the update interval of maven-public-int has elapsed or updates are forced
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:177)
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:226)
    at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:1000)
    at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:800)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:329)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:320)
    ... 49 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.google.guava:guava-parent:pom:31.1.0.redhat-00001 in https://nexus.akbankpreprod.com/repository/maven-public-int/ was cached in the local repository, resolution will not be reattempted until the update interval of maven-public-int has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:173)
    ... 54 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.google.guava:guava-parent:pom:31.1.0.redhat-00001 in https://nexus.akbankpreprod.com/repository/maven-public-int/ was cached in the local repository, resolution will not be reattempted until the update interval of maven-public-int has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:231)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
    ... 57 more
    pom.xml /ContractTestingFaturaProvider  line 1  Maven Dependency Problem

下面是在一个Eclipse示例上导致错误但在另一个示例上运行良好的依赖关系:

<dependency>
      <groupId>au.com.dius</groupId>
      <artifactId>pact-jvm-provider-spring_2.12</artifactId>
      <version>3.5.24</version>
      <scope>test</scope>
    </dependency>

这个有问题的eclipse示例使用Nexus,并且有一个包含以下POM的maven项目:

<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>ctfaturaprovider</groupId>
<artifactId>contract-testing-fatura-provider</artifactId>
<version>0.0.1-SNAPSHOT</version>

<!-- Kontrat testing ile ilgili parent: --> 
<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.1.RELEASE</version>
        <relativePath /> 
</parent>
<build>
    <finalName>BSA_ctfaturaprovider_ContractTestingFaturaProvider</finalName>
    <sourceDirectory>src</sourceDirectory>
    <testSourceDirectory>test</testSourceDirectory>
    <resources>
        <resource>
            <directory>src</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <version>2.5</version>
            <executions>
                <execution>
                    <id>update_bsa_versions</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>use-latest-snapshots</goal>
                    </goals>
                    <inherited>false</inherited>
                    <configuration>
                        <includes>com.akbank.*:*</includes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<distributionManagement>
    <snapshotRepository>
        <id>akbank-maven-snapshots</id>
        <name>akbank-maven-snapshots</name>
        <url>${akbank-maven-snapshots.url}</url>
    </snapshotRepository>

    <repository>
        <id>akbank-maven-releases</id>
        <name>akbank-maven-releases</name>
        <url>${akbank-maven-releases.url}</url>
    </repository>
</distributionManagement>

<dependencies>
    <!-- Kontrat testing ile ilgili dependency'ler: -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
            
    <!-- https://mvnrepository.com/artifact/au.com.dius.pact.provider/junit -->
    <dependency>
      <groupId>au.com.dius</groupId>
      <artifactId>pact-jvm-provider-spring_2.12</artifactId>
      <version>3.5.24</version>
      <scope>test</scope>
    </dependency>
    <!-- Kontrat testing ile ilgili dependency'ler sonu -->
    
    <dependency>
        <groupId>com.akbank.bsa</groupId>
        <artifactId>bsa-core</artifactId>
        <version>0.1.2-SNAPSHOT</version>
        <scope>provided</scope>
        <exclusions>
            <exclusion>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.akbank.bsa</groupId>
        <artifactId>bsa-unittest</artifactId>
        <version>1.0.2-SNAPSHOT</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
</project>

另一个eclipse不使用Nexus,它有一个使用POM的building maven项目:

<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>cagingroup</groupId>
  <artifactId>FaturaOdemeProvider</artifactId>
  <version>0.0.1-SNAPSHOT</version>
    <!-- Kontrat testing ile ilgili parent: -->
    <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.4.1.RELEASE</version>
            <relativePath /> 
    </parent>
    <dependencies>
        <!-- Kontrat testing ile ilgili dependency'ler: -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
                
        <!-- https://mvnrepository.com/artifact/au.com.dius.pact.provider/junit -->
        <dependency>
          <groupId>au.com.dius</groupId>
          <artifactId>pact-jvm-provider-spring_2.12</artifactId>
          <version>3.5.24</version>
          <scope>test</scope>
        </dependency>
        <!-- Kontrat testing ile ilgili dependency'ler sonu -->
    </dependencies>
</project>

依赖jar不是应该在我的本地m2上吗?当我检查C:\Users\57046.m2\repository\com\google\guava\guava\31.1.0.redhat-00001时,我没有看到任何jar。那么没有问题的eclipse究竟是如何找到这个jar的呢?
构建输出中的这个错误告诉我,有问题的Eclipse示例中的JBoss依赖项引用了未找到的guava版本:
[错误]无法对项目contract-testing-fatura-provider执行目标:无法解析项目ctfaturaprovider的依赖关系:合同测试提供程序:jar:0.0.1-快照:无法在以下位置收集依赖项:au. com. dius:pact-jvm-provider-spring_2. 12:jar:3.5.24-〉au. com. dius:pact-jvm-provider-junit_2. 12:jar:3.5.24-〉com. github. rholder:guava-重试:jar:2.0.0-〉com. google. guava:guava:jar:31.1.0.redhat-00001:无法读取com. google的工件描述符。guava:guava:jar:31.1.0.redhat-00001:无法在maven公共页面(https://nexus.akbankpreprod.com/repository/maven-public/)中找到页面错误
根据@howlger的评论,我将附加类路径文件,它们看起来如此不同。下面是一个工作正常的文件:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" output="target/test-classes" path="src/test/java">
        <attributes>
            <attribute name="test" value="true"/>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
        <attributes>
            <attribute name="test" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-11.0.16.1">
        <attributes>
            <attribute name="module" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

问题Eclipse中的类路径:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" output="target/test-classes" path="test">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.nondependency" value=""/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

我完全被困在这里了。我的Nexus开发人员还不能解决这个问题。另一个负责Eclipse问题的人说这是Nexus安装的问题。任何帮助都将非常感谢!我有点太情绪化了:D

wfypjpf4

wfypjpf41#

通过添加有问题依赖项的排除项解决了问题:

<dependency>
      <groupId>au.com.dius</groupId>
      <artifactId>pact-jvm-provider-spring_2.12</artifactId>
      <version>3.5.24</version>
      <scope>test</scope>
        <exclusions>
          <exclusion>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                  <version>31.1.0.redhat-00001</version>
            </exclusion>
        </exclusions>
    </dependency>

我的nexus人员说,在有问题的Eclipse版本中,JBoss设置需要这个Guava依赖项,并在pact-jvm-provide-spring之前加载它。这个Guava版本有问题,它的jar丢失了。但不知何故,Maven选择了它。另一个Eclipse示例没有JBoss,Maven选择了另一个版本的Guava。
也许我们在这里遇到了一个Maven错误:正在选择一个没有jar文件的依赖项。下面是导致Maven选择此版本Guava的POM:

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>[10.+,)</version>
  <scope>compile</scope>
</dependency>

因此,它要求10.+版本的Guava,Maven选择了没有jar文件的版本。

相关问题