spring-integration-kafka Maven构建错误:找不到spring-integration-kafka:jar:1.2.2.BUILD-SNAPSHOT

时间:2015-10-28 22:07:31

标签: spring-integration apache-kafka

我正在尝试编译(使用Maven)我在这里找到的简单的kafka参考项目:

https://github.com/spring-projects/spring-integration-samples/tree/master/basic/kafka

但是,当我运行mvn install -U

时,我反复出现此错误
[ERROR] Failed to execute goal on project kafka: Could not resolve dependencies for project org.springframework.integration.samples:kafka:jar:4.1.0.BUILD-SNAPSHOT: Could not find artifact org.springframework.integration:spring-integration-kafka:jar:1.2.2.BUILD-SNAPSHOT in repo.spring.io.milestone (https://repo.spring.io/libs-milestone) -> [Help 1]

当我去查看时,我可以看到我的.m2文件夹中的jar文件 - 我认为它应该是 - 在org / springframework / integration / spring-integration-kafka / 1.2.2下.BUILD.SNAPSHOT。它并不以.jar结尾,而是以.jar.lastUpdated

结尾

我尝试将项目作为maven项目加载到Spring Tools Suite并试图清理项目......但在这种情况下,我收到错误“存档为必需的库......在项目中'kafka'不能被读取或不是有效的ZIP文件。

我很难过 - 不知道从哪里开始 - 我已经吹走了目录并将其替换为原始项目下载几次。仍然没有快乐。

哦,我也尝试重命名该文件,希望它是一个有效的zip / jar,但显然它不是......

任何建议都将不胜感激。

==========谢谢Gary! ===========

我擦除'kafka'目录并从我下载的zip中重新添加 - 然后我尝试将该条目添加到POM并收到以下错误:

ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'repositories.repository.id' must be unique: repo.spring.io.milestone -> https://repo.spring.io/libs-milestone vs https://repo.spring.io/libs-snapshot @ line 114, column 8

然后我更改了存储库的名称,因此它会有所不同,因此:

<repository>
  <id>repo.spring.io.snapshot</id>
  <name>Spring Framework Maven Snapshot Repository</name>
  <url>https://repo.spring.io/libs-snapshot</url>
</repository>

再次运行mvn install -U,我收到以下警告和错误,关于POM for 1.3.0.M5丢失的问题......

[INFO] Building Apache Kafka Sample 4.1.0.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-maven-plugin/1.3.0.M5/spring-boot-maven-plugin-1.3.0.M5.pom
[WARNING] The POM for org.springframework.boot:spring-boot-maven-plugin:jar:1.3.0.M5 is missing, no dependency information available
Downloading: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-maven-plugin/1.3.0.M5/spring-boot-maven-plugin-1.3.0.M5.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.922 s
[INFO] Finished at: 2015-10-29T11:28:18-06:00
[INFO] Final Memory: 13M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.springframework.boot:spring-boot-maven-plugin:1.3.0.M5 or one of its dependencies could not be resolved: Could not find artifact org.springframework.boot:spring-boot-maven-plugin:jar:1.3.0.M5 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

如果它有帮助(或者在我指责的情况下)这里是POM的副本......再次感谢!

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.0.M5</version>
  </parent>
  <groupId>org.springframework.integration.samples</groupId>
  <artifactId>kafka</artifactId>
  <version>4.1.0.BUILD-SNAPSHOT</version>
  <name>Apache Kafka Sample</name>
  <description>Apache Kafka Sample</description>
  <url>http://projects.spring.io/spring-integration</url>
  <organization>
    <name>SpringIO</name>
    <url>https://spring.io</url>
  </organization>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>garyrussell</id>
      <name>Gary Russell</name>
      <email>grussell@pivotal.io</email>
      <roles>
        <role>project lead</role>
      </roles>
    </developer>
    <developer>
      <id>markfisher</id>
      <name>Mark Fisher</name>
      <email>mfisher@pivotal.io</email>
      <roles>
        <role>project founder and lead emeritus</role>
      </roles>
    </developer>
    <developer>
      <id>ghillert</id>
      <name>Gunnar Hillert</name>
      <email>ghillert@pivotal.io</email>
    </developer>
    <developer>
      <id>abilan</id>
      <name>Artem Bilan</name>
      <email>abilan@pivotal.io</email>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:scm:git:git://github.com/spring-projects/spring-integration-samples.git</connection>
    <developerConnection>scm:git:scm:git:ssh://git@github.com:spring-projects/spring-integration-samples.git</developerConnection>
    <url>https://github.com/spring-projects/spring-integration-samples</url>
  </scm>
  <dependencies>
    <dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-core</artifactId>
      <version>4.2.0.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>1.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-integration</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-kafka</artifactId>
      <version>1.2.2.BUILD-SNAPSHOT</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>4.2.0.RELEASE</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>1.9.5</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <id>repo.spring.io.milestone</id>
      <name>Spring Framework Maven Milestone Repository</name>
      <url>https://repo.spring.io/libs-milestone</url>
    </repository>
    <repository>
      <id>repo.spring.io.snapshot</id>
      <name>Spring Framework Maven Snapshot Repository</name>
      <url>https://repo.spring.io/libs-snapshot</url>
    </repository>
  </repositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>

1 个答案:

答案 0 :(得分:0)

POM中有一个错误;添加

<repository>
  <id>repo.spring.io.snapshot</id>
  <name>Spring Framework Maven Snapshot Repository</name>
  <url>https://repo.spring.io/libs-snapshot</url>
</repository>

到存储库部分。