无法执行目标 org.apache.felix:maven-bundle-plugin:2.3.7

Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.7

我正在 JBoss-Fuse 上开发一个来自 Create a Router Project 的项目。

虽然 运行 mvn -install ,但出现以下错误:

[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.7:bundle (default-bundle) on project camel-basic: Error calculating classpath for project MavenProject: org.fusesource.example:camel-basic:1.0-SNAPSHOT @ /home/pr.singh/Gemini/Java-General/Workspace/fuse/camel-basic/pom.xml: The JAR/ZIP file (/home/pr.singh/.m2/repository/org/apache/camel/camel-jetty/2.17.0.redhat-630187/camel-jetty-2.17.0.redhat-630187.jar) seems corrupted, error: invalid END header (bad central directory offset) -> [Help 1]

我完全按照 redhat 教程,我无法调试问题。请帮忙

我的 pom.xml 是:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.fusesource.example</groupId>
    <artifactId>camel-basic</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>bundle</packaging>
    <name>JBoss Fuse Quickstart: camel-cbr</name>
    <description>Camel Content-Based Router Example</description>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <distribution>repo</distribution>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>

    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.compiler.plugin>2.3.1</version.compiler.plugin>
    <version.maven-bundle-plugin>2.3.7</version.maven-bundle-plugin>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.source>1.7</maven.compiler.source>

    <!-- the version of the BOM, defining all the dependency versions -->
    <fabric8.bom.version>1.2.0.redhat-630187</fabric8.bom.version>
    <fabric.version>1.2.0.redhat-630187</fabric.version>

    <!-- fabric8 deploy profile configuration -->
    <fabric8.profile>camel-basic-profile</fabric8.profile>
    <fabric8.parentProfiles>feature-camel</fabric8.parentProfiles>
    <fabric8.features/>
  </properties>

    <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.fabric8.bom</groupId>
        <artifactId>fabric8-bom</artifactId>
        <version>${fabric8.bom.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

    <dependencies>
    <!--
     For this example, we will be using the OSGi Blueprint XML syntax for Apache Camel.
   -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-blueprint</artifactId>
    </dependency>
    <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jetty</artifactId>
        </dependency>
  </dependencies>

    <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${version.compiler.plugin}</version>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${version.maven-bundle-plugin}</version>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <!--
          this plugin will use the fabric.* properties to configure its behaviour
          see the Properties section here: http://fabric8.io/gitbook/mavenPlugin.html
        -->
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <version>${fabric.version}</version>
      </plugin>
    </plugins>
  </build>
</project>

在深入了解这个问题后,我找到了解决方案。

阅读错误代码行后:

Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.7:bundle

我认为 org.apace.felix 有一些问题,但后来我注意到了错误行:

The JAR/ZIP file (/home/pr.singh/.m2/repository/org/apache/camel/camel-jetty/2.17.0.redhat-630187/camel-jetty-2.17.0.redhat-630187.jar) seems corrupted

问题: 所以问题是我的骆驼码头罐子损坏了。

解法: 我简单地导航到 /home/pr.singh/.m2/repository/org/apache/camel 并删除了 camel jetty
运行 mvn clean install 在项目上创建了名为 camel jetty 的新文件(maven 安装了这个插件)。错误消失了。