Hello Guest

LWJGL and Maven + Help Needed

  • 14 Replies
  • 12504 Views
LWJGL and Maven + Help Needed
« on: April 12, 2010, 06:02:45 »
Hello everyone!

I couldn't find a Maven repository for LWJGL, so I was thinking about setting one up myself. What does the LWJGL developers think about providing an official Maven repository for LWJGL? I'm fairly new to Maven but I think I could set up a Nexus (http://nexus.sonatype.org/) repository if I got some assistance (and someone could provide a VPS - my home server is terribly unstable).

Here are some questions:

  • Would lwjgl, lwjgl-debug, lwjgl_applet, etc be artifacts under the lwjgl groupId?
  • Would jinput be an external dependency?
  • Where should I put the native files?

Thanks!

*

Offline Matzon

  • *****
  • 2242
Re: LWJGL and Maven + Help Needed
« Reply #1 on: April 12, 2010, 07:15:11 »
I couldn't find a Maven repository for LWJGL, so I was thinking about setting one up myself. What does the LWJGL developers think about providing an official Maven repository for LWJGL?

Generally speaking I have no issue with that, provided that the native libraries can be handled AND that its easy to update on new releases.

  • Would lwjgl, lwjgl-debug, lwjgl_applet, etc be artifacts under the lwjgl groupId?
  • Would jinput be an external dependency?
  • Where should I put the native files?
  • yes
  • yes
  • no idea - maven doesn't handle natives very well...

*

Offline Endolf

  • ***
  • 101
    • http://www.computerbooth.com/
Re: LWJGL and Maven + Help Needed
« Reply #2 on: April 12, 2010, 15:28:37 »
I created a maven repository at home for my own code, which uses LWJGL under ardor3d. I bundled the natives up in to 3 jars, one for each platform. They can then be unzipped or anything that is wanted.

The issue is how to build them. LWJGL has a generation stage also.

I have tweaked JUtils so that there is a target on the ant script to bung some resources in to a maven repository, but the build is still ant based, maybe this is an interim step?

Endolf

Re: LWJGL and Maven + Help Needed
« Reply #3 on: April 13, 2010, 11:57:27 »
I have tweaked JUtils so that there is a target on the ant script to bung some resources in to a maven repository

What does this ant target look like? I can try to convert it to fit LWJGL.

*

Offline Endolf

  • ***
  • 101
    • http://www.computerbooth.com/
Re: LWJGL and Maven + Help Needed
« Reply #4 on: April 14, 2010, 06:13:07 »
This is the target I wrote, it might not be the best way of doing things. It certainly won't help you resolve dependencies. JUtils has none, so that helped :)

Code: [Select]
<target name="install" depends="jar" description="Installs jutils in to local mvn repo">
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
             classpathref="maven-ant-tasks.classpath"/>

<artifact:pom id="jutilspom" groupId="net.java.games" artifactId="jutils" version="1.0.0">
</artifact:pom>
<artifact:writepom pomRefId="jutilspom" file="target/pom.xml"/>

<artifact:pom id="jutilspomfile" file="target/pom.xml" />

<artifact:install file="bin/jutils.jar">
<pom refid="jutilspomfile" />
</artifact:install>
</target>

*

Offline Endolf

  • ***
  • 101
    • http://www.computerbooth.com/
Re: LWJGL and Maven + Help Needed
« Reply #5 on: April 16, 2010, 17:12:09 »
How does this look?

additional repo needed, http://www.newdawnsoftware.com/maven2/

groupId="net.java.games" artifactId="jinput" version="2.0.1"

Hope that works.

Endolf

Re: LWJGL and Maven + Help Needed
« Reply #6 on: April 19, 2010, 00:23:49 »
Great job! :)

I'm trying to put a LWJGL repository together depending on your repository now. JInput downloads fine but I think I need some help with how I should modify my pom.xml so that it downloads JInput's native files.

I'll update this thread as soon as I have put something useful together.

*

Offline Endolf

  • ***
  • 101
    • http://www.computerbooth.com/
Re: LWJGL and Maven + Help Needed
« Reply #7 on: April 19, 2010, 05:58:37 »
You'll need to define 4 dependencies

One on JInput, then repeat 3 times adding a classifier to each one, the 3 classifiers are for each platform and are
Code: [Select]
<classifier>linux-natives</classifier>
<classifier>osx-natives</classifier>
<classifier>windows-natives</classifier>
That should download the zip archives, what you do with them is up to you :)

Endolf

Re: LWJGL and Maven + Help Needed
« Reply #8 on: April 20, 2010, 16:48:29 »
That should download the zip archives, what you do with them is up to you :)

Do you have a reason for putting the natives in zip files? The thing is that m2eclipse doesn't put the file on the classpath if it's not a JAR file. Could you change that?  :)

Thanks!

*

Offline Endolf

  • ***
  • 101
    • http://www.computerbooth.com/
Re: LWJGL and Maven + Help Needed
« Reply #9 on: April 20, 2010, 17:10:30 »
Does m2eclipse add natives to the java.library.path?, I contemplated sticking them all in one zip, as I normally want all natives. They will all need sticking in the same directory for java.library.path to work. The only time I don't want all of them is for webstart, when I want to be more platform specific, but I manage that seperatly.

If m2eclipse doesn't add the libs to somewhere on the java.library.path then you're going to have to do something with them anyway.

Endolf

Re: LWJGL and Maven + Help Needed
« Reply #10 on: April 20, 2010, 17:18:12 »
Does m2eclipse add natives to the java.library.path?

m2eclipse adds them to "." and sets java.library.path, but only if they are in JAR files. Do you prefer zip files, and if so, why? I got the impression from #maven @ Codehaus that JAR files would be more usable from a Maven point of view, not sure what they meant though.

*

Offline Endolf

  • ***
  • 101
    • http://www.computerbooth.com/
Re: LWJGL and Maven + Help Needed
« Reply #11 on: April 20, 2010, 17:42:40 »
I have no troubles changing to jars if it makes it more usable, I didn't realise it would be an issue. Try now :)

Endolf

Re: LWJGL and Maven + Help Needed
« Reply #12 on: April 20, 2010, 19:25:52 »
hi, working with arielsan we made a modification to the maven-webstart-plugin to expose the full dependencies to the template, and made a template that generates the jnlp file separating natives by OS

Template: http://lwjgl.pastebin.com/raw.php?i=HjUk23Tj

this allows us to have an automatic creation of webstart an applets, with automatic code signing and pack200, we can add any dependencies with or without natives and it just works (applets require java 1.6u10+)

for now the template is custom for the configuration of slick2d (using a mainclass that receives a game parameter) but that is easy to make generic.

if there is some interest we could publish the modified maven-webstart-plugin

we also require that the natives dependencies be jars instead of zip files

Re: LWJGL and Maven + Help Needed
« Reply #13 on: May 07, 2010, 17:18:20 »
i think first two question answers is yes, but for last one i am getting confused :-X

Re: LWJGL and Maven + Help Needed
« Reply #14 on: January 11, 2011, 11:50:09 »
is someone still working on this?
if so, i recommend using the sonatype repository. you can register for free, and when your submission meets some requirements (some mandatory tags like license and developers are defined), they will even transfer it to the main maven respository.

best link i could find:
http://jlorenzen.blogspot.com/2010/03/free-maven-repository-hosting-for-open.html

i know quite some open source projects that already use this.