jME / lwjgl Maven pom.xml setup

Hello,



i've read the following instructions but i still got a problem and i couldn't figure out whats going wrong yet:

http://www.jmonkeyengine.com/forum/index.php?topic=9996.0



Every time i try to exectue my program by calling 'mvn exec:java' i get this execution exception:




[INFO] An exception occured while executing the Java class. null
org.lwjgl.LWJGLException

[...]
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
[...]



Obviously he couldn't find the lwjgl libraries (lwjgl.jar, lwjgl_util_*.jar...). What part of the pom.xml is responsible for that? I guess the following lines belonging to the maven-dependency-plugin are the ones i'm looking for:


                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.lwjgl</groupId>
                                    <artifactId>lwjgl</artifactId>
                                    <version>2.0rc1</version>
                                    <type>jar</type>
                                    <classifier>${build-type}</classifier>
                                    <outputDirectory>${basedir}/lib/lwjgl/</outputDirectory>
                                </artifactItem>



Is this correct ? My Eclipse project is structured like this:



-> src/main/java
-> src/test/java
-> lib
     -> lwjgl
             ->native
                  -> windows
                  -> etc.
              -> lwgjl.jar
              -> lwjgl_util*.jar
              -> etc.



So in my understanding my settings should be allright.

Any ideas what might be wrong with my classpath?


Regarding the lwjgl.natives:

The systemProperty 'org.lwjgl.librarypath' is used by lwjgl to locate the appropriate native library. So we've got to set it in the exec plugin to the following:



<lwjgl.natives>${basedir}/lib/lwjgl/native/</lwjgl.natives>
[...]
                      <systemProperty>
                            <key>org.lwjgl.librarypath</key>
                            <value>${lwjgl.native}</value>
                        </systemProperty>



The following profiles are responsible for specifing the lwjgl.native variable to the actual folder depending on the system os. Right?

Do you have all of the lwjgl dependencies listed?


<dependencies>
        <dependency>
            <groupId>org.lwjgl</groupId>
            <artifactId>lwjgl</artifactId>
            <version>2.1</version>
        </dependency>
...
</dependencies>



ClassNotFound means it just isn't finding the lwjgl class, and thus it's not on your classpath.
I haven't tried mvn exec:java, so I'm not sure if there is something else you have to define in there, but it should run from your target directory, and that should have your lwjgl jar in it.

(note that in my code-snippit, I have the jars deployed in my own private repository under the path I have listed. You will have to use 'mvn deploy' to add them to your local repo)

Hi, thanks for your answer :slight_smile:


Do you have all of the lwjgl dependencies listed?


Well, thats the interesting part. They havn't listed them either. But i assumed that the "maven-dependency-plugin" would do that job (last post in the linked thread by 'osechet'). But in the wiki that one isn't even there.
http://www.jmonkeyengine.com/wiki/doku.php?id=jme_maven_setup

But you might be right and they're just missing there.

You will have to use 'mvn deploy' to add them to your local repo


'install'; 'deploy' is for adding the artifacts to a remote repo.

I'll just add them tomorrow to my remote repo...just thought it would work in some mysterious ways ;)

Thank you!
'install'; 'deploy' is for adding the artifacts to a remote repo.

err, yea sorry I meant mvn install:install-file

in the lib directory of the jme source there is a mvn-lib-install.sh file that has most of the dependencies laid out for you.

Maven should just work :) ... if the deployed jar has a pom file with it that lists its dependencies in there, then maven can go and grab them too. But if the pom file is missing or deployed by hand, then it won't list the dependencies.