Spring集成问题:“无法读取工件描述”

时间:2016-11-21 09:11:11

标签: java spring maven spring-integration

我正在学习使用Spring集成,我正在使用他在网上找到的教程。 在适配器上进行练习,我正在使用这个基本的pom文件:

<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>com.intertech.si</groupId>
    <artifactId>lab2-adapters</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Spring Integration Lab 2</name>
    <description>Lab 2 - using adapters</description>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <springframework.version>4.0.4.RELEASE</springframework.version>
        <spring.integration.version>4.0.0.RELEASE</spring.integration.version>
        <spring.integration.xml.version>4.0.0.RELEASE</spring.integration.xml.version>
        <log4j.version>1.2.17</log4j.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-core</artifactId>
            <version>${spring.integration.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-stream</artifactId>
            <version>${spring.integration.version}</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
    </dependencies> 
</project>

按照教程的说明,我需要添加这些依赖项:

<dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-file</artifactId>
            <version>${spring.integration.version}</version>
        </dependency>

但是当我这样做并且我尝试保存文件时,我在控制台日志上犯了很多错误:

Description Resource    Path    Location    Type
Failed to read artifact descriptor for org.springframework.integration:spring-integration-file:jar:4.0.0.RELEASE

org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.springframework.integration:spring-integration-file:jar:4.0.0.RELEASE
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:282)
    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.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.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:398)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:345)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.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.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1351)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:342)
    at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to transfer org.springframework.integration:spring-integration-file:pom:4.0.0.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.integration:spring-integration-file:pom:4.0.0.RELEASE from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Errore temporaneo nella risoluzione del nome
    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.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:267)
    ... 33 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer org.springframework.integration:spring-integration-file:pom:4.0.0.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.integration:spring-integration-file:pom:4.0.0.RELEASE from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Errore temporaneo nella risoluzione del nome
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:238)
    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)
    ... 36 more
    pom.xml /lab2-adapters-starter  line 1  Maven Dependency Problem

他的问题是特定于最后添加的依赖项,因为如果我尝试删除此文件并保存文件,我没有错误。

可能是什么事?

2 个答案:

答案 0 :(得分:0)

下载文件时出现问题。我不知道为什么,但Maven不能自己解决这个问题。到达本地存储库缓存,如果您没有更改它,请访问:[USER-DIR] .m2 \ repository,并删除&#34; org \ springframework \ integration&#34;。

答案 1 :(得分:0)

这个pom.xml文件在我的PC环境中正常运行。但我的本地m2存储库中没有任何其他旧spring integration jar。所以,根据你的错误信息:

  

引起:org.eclipse.aether.resolution.ArtifactResolutionException:   未能转移   org.springframework.integration:弹簧集成文件:POM:4.0.0.RELEASE   来自https://repo.maven.apache.org/maven2缓存在本地   存储库,解决方案在更新之前不会重新尝试   中心间隔已经过去或强制更新。原始错误:   无法转移神器   org.springframework.integration:弹簧集成文件:POM:4.0.0.RELEASE   从/到中央(https://repo.maven.apache.org/maven2):   repo.maven.apache.org:Errore temporaneo nella risoluzione del nome

您是否注意到https://repo.maven.apache.org/maven2 中的#34;已缓存在本地存储库中&#34;消息中的消息。?

或许,您本地存储库中的先前版本spring integration jar与新spring integration jar.

冲突

1)第一种方式(我确信)
我认为您需要删除文件夹$HOME/.m2/repository/org/springframework/integration

之后,使用mvn命令或Eclipse重建并更新 maven

2)第二种方式(我不确定)
你不需要删除任何旧罐子。您只需使用mvn命令或Eclipse执行强制更新到存储库。