Maven Build期间的NoClassDefFoundError

时间:2014-07-31 05:28:59

标签: java maven bukkit

我正在尝试使用本教程制作Bukkit插件: http://wiki.bukkit.org/Plugin_Tutorial

一切都很棒,除非我尝试以任何方式使用Maven构建项目(清理,构建,测试),它给了我这个错误:

java.lang.NoClassDefFoundError: org/eclipse/osgi/internal/baseadaptor/DevClassPathHelper
at org.eclipse.m2e.core.internal.embedder.MavenEmbeddedRuntime.addBundleClasspathEntries(MavenEmbeddedRuntime.java:193)
at org.eclipse.m2e.core.internal.embedder.MavenEmbeddedRuntime.initClasspath(MavenEmbeddedRuntime.java:127)
at org.eclipse.m2e.core.internal.embedder.MavenEmbeddedRuntime.createLauncherConfiguration(MavenEmbeddedRuntime.java:107)
at org.eclipse.m2e.internal.launch.MavenRuntimeLaunchSupport.create(MavenRuntimeLaunchSupport.java:119)
at org.eclipse.m2e.internal.launch.MavenLaunchDelegate.launch(MavenLaunchDelegate.java:70)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:883)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.ClassNotFoundException: org.eclipse.osgi.internal.baseadaptor.DevClassPathHelper cannot be found by org.eclipse.m2e.core_1.4.0.20130601-0317
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 10 more

我的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>io.github.learning25</groupId>
  <artifactId>TestPlugin</artifactId>
  <version>0.0.1-SNAPSHOT</version>
   <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                  <source>1.7</source>
                  <target>1.7</target>
              </configuration>
          </plugin>
      </plugins>
   </build>
    <repositories>
       <repository>
           <id>bukkit-repo</id>
           <url>http://repo.bukkit.org/content/groups/public/</url>
       </repository>
   </repositories>
   <dependencies>
       <dependency>
           <groupId>org.bukkit</groupId>
           <artifactId>bukkit</artifactId>
           <version>1.6.4-R2.0</version>
           <type>jar</type>
           <scope>compile</scope>
       </dependency>
   </dependencies>
</project>

1 个答案:

答案 0 :(得分:3)

我自己也遇到了同样的问题。它似乎是由这个错误引起的,并且引起了Eclipse Luna和M2E插件的问题:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=412436

假设您 使用Luna并安装了M2E,我通过卸载M2E并使用&#34;安装新软件&#34;重新安装来解决问题。路线而不是&#34;市场&#34;。无法说出原因,但这似乎对我有用。