LWJGL and Maven + Help Needed

Started by jonkri, April 12, 2010, 06:02:45

Previous topic - Next topic

jonkri

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!

Matzon

Quote from: jonkri on April 12, 2010, 06:02:45
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.

Quote from: jonkri on April 12, 2010, 06:02:45

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

Endolf

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

jonkri

Quote from: Endolf on April 12, 2010, 15:28:37
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.

Endolf

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

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

Endolf

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

jonkri

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.

Endolf

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

jonkri

Quote from: Endolf on April 19, 2010, 05:58:37
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!

Endolf

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

jonkri

Quote from: Endolf on April 20, 2010, 17:10:30
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.

Endolf

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

ruben01

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

dravid123

i think first two question answers is yes, but for last one i am getting confused :-X

hoijui

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.