java.lang.NoClassDefFoundError:org / wildfly / swarm / bootstrap / util / MavenArtifactDescriptor

时间:2018-05-20 15:58:33

标签: java maven-3 wildfly maven-plugin wildfly-swarm

通过网站使用“WildFly Swarm项目生成器”工具,它生成一个要下载的演示项目,但是当本地Maven执行构建和执行的步骤时,会发生以下错误:

mvn clean wildfly-swarm:运行

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>com.example</groupId>
  <artifactId>demo</artifactId>
  <name>WildFly Swarm Example</name>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <properties>
    <version.wildfly.swarm>2018.5.0</version.wildfly.swarm>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.wildfly.swarm</groupId>
        <artifactId>bom-all</artifactId>
        <version>${version.wildfly.swarm}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <finalName>demo</finalName>
    <plugins>
      <plugin>
        <groupId>org.wildfly.swarm</groupId>
        <artifactId>wildfly-swarm-plugin</artifactId>
        <version>${version.wildfly.swarm}</version>

        <executions>
          <execution>
            <goals>
              <goal>package</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <!-- Java EE 7 dependency -->
    <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>7.0</version>
      <scope>provided</scope>
    </dependency>
    <!-- WildFly Swarm Fractions -->
    <dependency>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>jaxrs</artifactId>
    </dependency>
  </dependencies>
</project>

日志:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building WildFly Swarm Example 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ demo ---
[INFO] Deleting /home/cbelleza/Downloads/demo/target
[INFO] 
[INFO] >>> wildfly-swarm-plugin:2018.5.0:run (default-cli) > package @ demo >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/cbelleza/Downloads/demo/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/cbelleza/Downloads/demo/target/classes
[WARNING] error reading /home/cbelleza/.m2/repository/javax/javaee-api/7.0/javaee-api-7.0.jar; invalid LOC header (bad signature)
[WARNING] error reading /home/cbelleza/.m2/repository/org/wildfly/swarm/bootstrap/2018.5.0/bootstrap-2018.5.0.jar; invalid LOC header (bad signature)
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/cbelleza/Downloads/demo/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ demo ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ demo ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:2.2:war (default-war) @ demo ---
[INFO] Packaging webapp
[INFO] Assembling webapp [demo] in [/home/cbelleza/Downloads/demo/target/demo]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/cbelleza/Downloads/demo/src/main/webapp]
[INFO] Webapp assembled in [78 msecs]
[INFO] Building war: /home/cbelleza/Downloads/demo/target/demo.war
[INFO] 
[INFO] --- wildfly-swarm-plugin:2018.5.0:package (default) @ demo ---
[WARNING] Error injecting: org.wildfly.swarm.plugin.maven.PackageMojo
java.lang.NoClassDefFoundError: org/wildfly/swarm/bootstrap/util/MavenArtifactDescriptor
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:688)
    at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:380)
    at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:164)
    at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:613)
    at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:569)
    at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:555)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:884)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
    at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
    at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
    at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
    at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
    at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:517)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:352)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:197)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: org.wildfly.swarm.bootstrap.util.MavenArtifactDescriptor
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
    ... 76 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.262 s
[INFO] Finished at: 2018-05-20T13:04:45-03:00
[INFO] Final Memory: 28M/250M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wildfly.swarm:wildfly-swarm-plugin:2018.5.0:package (default) on project demo: Execution default of goal org.wildfly.swarm:wildfly-swarm-plugin:2018.5.0:package failed: A required class was missing while executing org.wildfly.swarm:wildfly-swarm-plugin:2018.5.0:package: org/wildfly/swarm/bootstrap/util/MavenArtifactDescriptor
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.wildfly.swarm:wildfly-swarm-plugin:2018.5.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/cbelleza/.m2/repository/org/wildfly/swarm/wildfly-swarm-plugin/2018.5.0/wildfly-swarm-plugin-2018.5.0.jar
[ERROR] urls[1] = file:/home/cbelleza/.m2/repository/org/wildfly/swarm/fraction-metadata/2018.5.0/fraction-metadata-2018.5.0.jar
[ERROR] urls[2] = file:/home/cbelleza/.m2/repository/org/wildfly/swarm/meta-spi/2018.5.0/meta-spi-2018.5.0.jar
[ERROR] urls[3] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-impl-javaee/2.0.0/shrinkwrap-descriptors-impl-javaee-2.0.0.jar
[ERROR] urls[4] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-impl-base/2.0.0/shrinkwrap-descriptors-impl-base-2.0.0.jar
[ERROR] urls[5] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-spi/2.0.0/shrinkwrap-descriptors-spi-2.0.0.jar
[ERROR] urls[6] = file:/home/cbelleza/.m2/repository/org/ow2/asm/asm/6.0/asm-6.0.jar
[ERROR] urls[7] = file:/home/cbelleza/.m2/repository/com/eclipsesource/minimal-json/minimal-json/0.9.4/minimal-json-0.9.4.jar
[ERROR] urls[8] = file:/home/cbelleza/.m2/repository/org/wildfly/swarm/tools/2018.5.0/tools-2018.5.0.jar
[ERROR] urls[9] = file:/home/cbelleza/.m2/repository/org/wildfly/swarm/bootstrap/2018.5.0/bootstrap-2018.5.0.jar
[ERROR] urls[10] = file:/home/cbelleza/.m2/repository/org/jboss/modules/jboss-modules/1.6.1.Final/jboss-modules-1.6.1.Final.jar
[ERROR] urls[11] = file:/home/cbelleza/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar
[ERROR] urls[12] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/shrinkwrap-api/1.2.6/shrinkwrap-api-1.2.6.jar
[ERROR] urls[13] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/shrinkwrap-spi/1.2.6/shrinkwrap-spi-1.2.6.jar
[ERROR] urls[14] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/shrinkwrap-impl-base/1.2.6/shrinkwrap-impl-base-1.2.6.jar
[ERROR] urls[15] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-jboss/2.0.0/shrinkwrap-descriptors-api-jboss-2.0.0.jar
[ERROR] urls[16] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-javaee/2.0.0/shrinkwrap-descriptors-api-javaee-2.0.0.jar
[ERROR] urls[17] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-base/2.0.0/shrinkwrap-descriptors-api-base-2.0.0.jar
[ERROR] urls[18] = file:/home/cbelleza/.m2/repository/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-impl-jboss/2.0.0/shrinkwrap-descriptors-impl-jboss-2.0.0.jar
[ERROR] urls[19] = file:/home/cbelleza/.m2/repository/net/lingala/zip4j/zip4j/1.3.2/zip4j-1.3.2.jar
[ERROR] urls[20] = file:/home/cbelleza/.m2/repository/org/wildfly/swarm/spi/2018.5.0/spi-2018.5.0.jar
[ERROR] urls[21] = file:/home/cbelleza/.m2/repository/org/jboss/jandex/2.0.3.Final/jandex-2.0.3.Final.jar
[ERROR] urls[22] = file:/home/cbelleza/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
[ERROR] urls[23] = file:/home/cbelleza/.m2/repository/org/eclipse/aether/aether-util/1.0.0.v20140518/aether-util-1.0.0.v20140518.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.wildfly.swarm.bootstrap.util.MavenArtifactDescriptor
[ERROR] -> [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/PluginContainerException

有没有丢失的步骤?甚至是在Maven中应用的配置。

1 个答案:

答案 0 :(得分:2)

在您的错误日志中有该消息,无效的LOC标头(错误的签名)。

删除该jar,以便maven再次下载;另见Deploying Maven project throws java.util.zip.ZipException: invalid LOC header (bad signature)