0

だから長い間、私はウェブを検索して、他の人々の問題や修正を常に見ていて、彼らが私の問題に敬意を払ってくれることを望んでいますが、playn に関連する同じ問題を抱えている人を見つけることができないようです.

「mvn test」を実行して cmd と mu の小さなプロジェクトを完全に実行できますが、最終的に「mvn clean install」を使用してプロジェクトをエクスポートし、実行しよmyApp-core-1.0-SNAPSHOT.jarうとすると例外が発生します。

Exception in thread "main" java.NoClassDefFoundError: playn/core/game

このアプリは私のAレベルのコースワークであり、すぐに提出される予定なので、過去に誰かがこの問題に遭遇したことがあり、それを克服するための正しい方向に向けることができるかどうか疑問に思っています.日付の提出期限、これが起こらないことを本当に願っています D:

これは私のmyApp-core 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>
<parent>

<groupId>com.ALevelWork</groupId>
<artifactId>zombiepanic</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>zombiepanic-core</artifactId>
<packaging>jar</packaging>
<name>ZombiePanic Core</name>

<dependencies>
<dependency>
  <groupId>com.googlecode.playn</groupId>
  <artifactId>playn-jbox2d</artifactId>
  <version>${playn.version}</version>
</dependency>

<dependency>
  <groupId>com.googlecode.playn</groupId>
  <artifactId>playn-core</artifactId>
  <version>${playn.version}</version>
</dependency>

</dependencies>

<build>
<plugins>   

    <plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
  <manifest>
  <addClasspath>true</addClasspath>
  <classpathPrefix>lib/</classpathPrefix>
      <mainClass> ZombiePanic.core.ZombiePanic</mainClass>
  </manifest>
 </archive>
 </configuration>
 </plugin>

   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
  </plugin>
  </plugins>

  <resources>
  <!-- include the source files in our main jar for use by GWT -->
  <resource>
    <directory>${project.build.sourceDirectory}</directory>
  </resource>
  <!-- and continue to include our standard resources -->
  <resource>
    <directory>${basedir}/src/main/resources</directory>
    </resource>
  </resources>
 </build>
 </project>

前もって感謝します、

ジェイコブ

4

1 に答える 1

0

このチュートリアル (http://jameswilliams.be/blog/entry/255) に従ってこの問題を修正しました。最初に追加する必要があるこれを行うために、ゾンビパニックコアを Java バックエンド (zombiepanic-java) にリンクしていませんでした。このプラグインを Java バックエンド pom.xml に追加します。

<plugin>
    <groupId>org.sonatype.plugins</groupId>
    <artifactId>jarjar-maven-plugin</artifactId>
<version>1.5</version>
<executions>
    <execution>
        <phase>package</phase>
        <goals>
            <goal>jarjar</goal>
        </goals>
        <configuration>
            <rules />
        </configuration>
    </execution>
</executions>

これを行ったら、これも Java バックエンド pom.xml に追加して、コア クラス (zombiepanic-core) にリンクします。

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>com.YourPackage.java.JarJarDemoJava</mainClass> </manifest> </archive> </configuration> </plugin>

メイン クラスを、ZombiePanic だけのコア バージョンではなく、ZombiePanicJava などの Java バックエンド バージョンにリンクすることを忘れないでください。

于 2012-12-27T21:36:19.607 に答える