尝试构建一个eclipse插件。当我尝试运行mvn install时,我收到以下错误消息:
java.lang.NoClassDefFoundError: org/eclipse/xtext/common/types/DefaultCommonTypesRuntimeModule
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
显然,NoClassDefFoundError意味着该类在运行时不可用。这个插件实际上并不运行xtext代码,但它是使用xtext语言插件构建的。我的猜测是在运行时获取代码会有问题吗?我maven安装了父插件,甚至通过maven在本地链接它的jar,这仍然会弹出。想法?
这也是该项目的主题:
<?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>de.fu_berlin.inf.archnemesis</groupId>
<artifactId>archnemesis-pmd-rule</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Archnemesis PMD Plugin</name>
<description>Archnemesis rule implementation for PMD</description>
<dependencies>
<dependency>
<groupId>de.fu_berlin.inf.archnemesis</groupId>
<artifactId>de.fu_berlin.inf.archnemesis</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>5.0.5</version>
</dependency>
<dependency>
<groupId>de.fu_berlin.inf.archnemesis</groupId>
<artifactId>de.fu_berlin.inf.archnemesis-core-rule</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>org.eclipse.xtend.lib</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:1)
尝试将以下依赖项添加到pom.xml
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.common.types</artifactId>
<version>2.8.4</version>
</dependency>