14

我刚开始使用 m2e 尝试构建示例 travellog elastic beanstalk 项目。在控制台上,我收到“[ERROR] 项目读取错误”。

这在“依赖层次结构”选项卡上也显示为红色。

这是什么意思,我如何找到更多详细信息?

编辑:添加 pom.xml

<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>BeanstalkTest</groupId>
  <artifactId>BeanstalkTest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>[1.0.007,)</version>
        </dependency>
    </dependencies>

</project>
4

1 回答 1

22

行。所以我想我想通了。

在 workspace\.metadata 中有日志文件,例如 .log 我的有这个条目:

!ENTRY org.eclipse.m2e.logback.appender 4 0 2012-05-28 18:50:44.641
!MESSAGE Project read error

你可以进去看看:

工作区\.metadata\.plugins\org.eclipse.m2e.logback.configuration

查找 m2e 的日志文件,例如 0.log

这些非常详细和有用。无论如何,我的日志文件有这个条目:

2012-05-28 18:50:44,640 [Worker-52] ERROR o.e.m.editor.pom.DependencyTreePage - Project read error
org.eclipse.core.runtime.CoreException: Project read error
    at org.eclipse.m2e.core.embedder.MavenModelManager.readDependencyTree(MavenModelManager.java:230) ~[na:na]
    at org.eclipse.m2e.editor.pom.MavenPomEditor.readDependencyTree(MavenPomEditor.java:701) ~[na:na]
    at org.eclipse.m2e.editor.pom.DependencyTreePage$1.run(DependencyTreePage.java:215) ~[na:na]
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) [org.eclipse.core.jobs_3.5.101.v20120113-1953.jar:na]
Caused by: org.sonatype.aether.collection.DependencyCollectionException: Failed to collect dependencies for [com.amazonaws:aws-java-sdk:jar:[1.0.007,) (compile)]
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:262) ~[na:na]
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:345) ~[na:na]
    at org.eclipse.m2e.core.embedder.MavenModelManager.readDependencyTree(MavenModelManager.java:226) ~[na:na]
    ... 3 common frames omitted
Caused by: org.sonatype.aether.resolution.VersionRangeResolutionException: Failed to resolve version range for org.codehaus.jackson:jackson-mapper-asl:jar:[1.8.): Invalid version range [1.8.), single version must be surrounded by []
    at org.apache.maven.repository.internal.DefaultVersionRangeResolver.resolveVersionRange(DefaultVersionRangeResolver.java:114) ~[na:na]
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:378) ~[na:na]
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:533) ~[na:na]
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:243) ~[na:na]
    ... 5 common frames omitted
Caused by: org.sonatype.aether.version.InvalidVersionSpecificationException: Invalid version range [1.8.), single version must be surrounded by []
    at org.sonatype.aether.util.version.GenericVersionRange.<init>(GenericVersionRange.java:84) ~[na:na]
    at org.sonatype.aether.util.version.GenericVersionScheme.parseVersionRange(GenericVersionScheme.java:40) ~[na:na]
    at org.sonatype.aether.util.version.GenericVersionScheme.parseVersionConstraint(GenericVersionScheme.java:66) ~[na:na]
    at org.apache.maven.repository.internal.DefaultVersionRangeResolver.resolveVersionRange(DefaultVersionRangeResolver.java:109) ~[na:na]
    ... 8 common frames omitted

因此,aws-java-sdk 依赖项的定义似乎存在问题。它指定 jackson-mapper-asl 可以是版本 [1.8.),这似乎是无效的语法。

如果我修改 pom.xml 以排除该依赖项,它将变为:

<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>BeanstalkTest</groupId>
  <artifactId>BeanstalkTest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>[1.0.007,)</version>
             <exclusions>
                <exclusion>
                    <groupId>org.codehaus.jackson</groupId>
                    <artifactId>jackson-mapper-asl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

</project>

这不会产生“项目读取错误”。所以,基本上有两件事:

  1. 日志文件如上所示,并且
  2. aws-java-sdk依赖的定义好像有问题

谢谢卢卡。

于 2012-05-29T02:11:56.483 回答