0

so for a long time now i have been searching the web constantly looking at other peoples problems and fixes hoping they will be reverent to my issue, but i cant seem to find anyone with the same issue involving playn.

i can run "mvn test" the the cmd and mu little project runs perfectly, however when i come to finally exporting the project using "mvn clean install" and attemt to run the myApp-core-1.0-SNAPSHOT.jar i get an Exception:

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

im just wondering if anone has come across this problem in the past and can point me in the right direction to overcoming it, since this app is my A-level coursework and is due to be handed in soon i am very worried i may not reach the deadline for handing in dates, i really hope this doesnt happen D:

this is my 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>

Thanks in advance,

Jacob

1 Answers1

0

i have fixed this problem by following this tutorial (http://jameswilliams.be/blog/entry/255), i was not linking the zombiepanic-core to the java backend (zombiepanic-java) to do this you need to firstly add this plug-in into the java backend 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>

once you have done this, link it to the core class (zombiepanic-core) by adding this also into the java backend pom.xml:

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

remember to link the main class to your java backend version, for example ZombiePanicJava instead of the core version which is just ZombiePanic.