n00b: Getting LWJGL working in Eclipse with maven / m2eclipse?

Started by roach, March 16, 2013, 23:47:58

Previous topic - Next topic

roach

Trying to learn LWJGL, but I'm having a hard time getting it working with Maven / m2eclipse. I followed http://www.lwjgl.org/wiki/index.php?title=LWJGL_use_in_Maven, but the native libraries aren't being installed properly. I just get the dreaded "java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path" every time I try to run. Build succeeds, but I can't run anything. I'd rather solve this using the maven-nativedependencies-plugin, since I want to eventually be able to provide a packaged app to the end user without requiring them to know about JVM Command-line arguments, etc.

Can anyone point me to a GitHub project that uses LWJGL with Maven, and actually works, that I could use to try and troubleshoot?

EDIT: Forgot to mention, I'm using:
Eclipse "Juno" on OS X
m2eclipse plugin v1.3.1

And here's my 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/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.skyline.lwjgl</groupId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <natives.version>0.0.7</natives.version>
        <lwjgl.version>2.8.2</lwjgl.version>
        <slick.version>274</slick.version>
        <junit.version>4.10</junit.version>
    </properties>

    <repositories>
        <repository>
            <id>mavenNatives</id>
            <name>Maven Natives Repository</name>
            <url>http://mavennatives.googlecode.com/svn/repo</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>slick</id>
            <name>slick</name>
            <url>http://slick.cokeandcode.com/mavenrepo</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.lwjgl.lwjgl</groupId>
            <artifactId>lwjgl</artifactId>
            <version>${lwjgl.version}</version>
        </dependency>
        <dependency>
            <groupId>slick</groupId>
            <artifactId>slick</artifactId>
            <version>${slick.version}</version>
        </dependency>
        <dependency>
            <groupId>java3d</groupId>
            <artifactId>vecmath</artifactId>
            <version>1.3.1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
	    <pluginManagement>
	        <plugins>
	            <plugin>
	                <groupId>org.apache.maven.plugins</groupId>
	                <artifactId>maven-compiler-plugin</artifactId>
	                <configuration>
	                    <source>1.6</source>
	                    <target>1.6</target>
	                </configuration>
	            </plugin>
	
	            <plugin>
	                <groupId>com.googlecode.mavennatives</groupId>
	                <artifactId>maven-nativedependencies-plugin</artifactId>
	                <version>${natives.version}</version>
	                <executions>
	                    <execution>
	                        <id>unpacknatives</id>
	                        <phase>generate-resources</phase>
	                        <goals>
	                            <!--suppress MavenModelInspection (this line is for IDEA)-->
	                            <goal>copy</goal>
	                        </goals>
	                    </execution>
	                </executions>
	            </plugin>
	        </plugins>
        </pluginManagement>
    </build>
    <artifactId>basics</artifactId>
</project>

mwohlf

here is a pom.xml that works for me:
https://github.com/mwohlf/basic/blob/master/pom.xml

however, you still need to setup your VM arguments in your Run Configurations in eclipse