[libgdx] Importing libgdx libraries into a non-libgdx project

Hello. I’m currently trying to build a server for my game. I’m most of the way there, except I would like to use a consistent library for items like Vector2s between my client and server side. Therefore, I would like to import the libgdx library for my server project. I’d prefer not to start a new libgdx project and transfer my server onto it.

I’ve tried importing the libgdx JAR from the filepath in my client’s gradle project, but I just got empty packages (because it’s gradle?). Next I’m going to try compiling the open source of libgdx that’s on github. I’m pretty sure this will work, but it feels like there should be a better way. Is there?

Edit: Success w/ github proj.

Presuming you don’t need the majority of it and are only after a few things like vectors you mention, etc, why not rip the particular parts you need from the source?

It seems unnecessary to use the entire library just for your server.

@danieldean

That’s probably the best solution. However, I’m still curious :-X.

You need to add the correct jar to your classpath.

How you do that depends on whether you’re using maven, gradle, eclipse, the command line, etc.

LibGDX uses gradle to build itself, but that doesn’t mean you need to use gradle to use the libGDX jars. For example, here is the maven repository for libGDX jars: http://mvnrepository.com/artifact/com.badlogicgames.gdx

The nightlies still exist: libgdx.badlogicgames.com/nightlies/