Failed to execute goal org.apache.felix:maven-bund

2019-07-28 06:01发布

I was developing a project on JBoss-Fuse from Create a Router Project.

While running mvn -install , I am getting following error:

[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]

I exactly following the redhat tutorial, I am unable to debug the problem. Please help.

My pom.xml is :

<?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>

1条回答
女痞
2楼-- · 2019-07-28 06:45

After digging a bit about the issue, I found the solution to it.

After reading the line of error code that says:

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

I thought there is some issue with org.apace.felix, but later I paid attention to the line of error that was stating :

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

Issue: So the issue was that my camel-jetty jar was corrupted.

Solution: I simple navigated to /home/pr.singh/.m2/repository/org/apache/camel and deleted camel jetty.
Run mvn clean install on project and new file with name camel jetty was created (maven installed this plugin). And error was gone.

查看更多
登录 后发表回答