Is libtiled-java available on any maven server?


(Casper Færgemand) #1

It doesn’t appear on Maven Central, is it available elsewhere? Can it be made available?


(Thorbjørn Lindeijer) #2

I guess it could, with the only problem that I have no idea what I’d need to do for this. The issue kind of got stuck here, and so far I haven’t gotten around at digging into those docs:

https://github.com/bjorn/tiled/issues/397#issuecomment-274924418

Any guidance would be greatly appreciated.

Note however, that apart from making libtiled-java properly accessible, a major issue is still that the library is somewhat outdated and doesn’t currently have a maintainer.


(Mike Thomas) #3

I uploaded an older version to sonatype snapstots repository a while back, which can be acessed by adding the following to your pom:

<repositories>
    <repository>
        <id>sonatype-oss</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.mapeditor</groupId>
        <artifactId>libtiled</artifactId>
        <version>0.17-SNAPSHOT</version>
        <type>jar</type>
    </dependency>
    ...
</dependencies>

I am currently updating the java libraries to use the latest tmx map updates (see https://github.com/mikepthomas/tiled/commit/e95050054df80ba871323feccdf73f973a79f875) which I am using for a personal project I am developing which is taking up most of my free time at the moment.

The binaries need to be signed by a pgp key so that they can be upladed to maven central… @bjorn, if you are ok with me using my own key rather than yours? then I can see about publishing the version in the master branch to central for you.


(Thorbjørn Lindeijer) #4

What a huge change! Looking forward to reviewing it. :wink:

That would be perfectly fine with me. Thanks for your help!


(Mike Thomas) #5

It’s not quite ready for prime time just yet but will definately raise a pull request when it is :slight_smile:

I have staged a release in nexus (see attached screenshot), if you want to take a look using the login you created for your jira account:

All that is left to do is click the release button and comment on the jira ticket as it is the first release so that they can start the sync process to central.

let me know if you are happy with what’s in the release (you can view the contents in the “Content” tab you can see in the screenshot) and I’ll start the process to deploy to central.


(Thorbjørn Lindeijer) #6

Contents look fine as far as I can see. What is the purpose of tiled-parent?


(Mike Thomas) #7

It’s the main project file containing the configuration for libtiled and tmxviewer. It just makes it easier to share common plugins and build config with both modules.

I’ll start the process of deploying now and will let you know when the artefacts are available in maven central :smiley:


(Mike Thomas) #8

It looks like the release has been completed as the jar files are now available in the central repository:
http://central.maven.org/maven2/org/mapeditor/

You should now be able to request the jar using the following:

<dependency>
    <groupId>org.mapeditor</groupId>
    <artifactId>libtiled</artifactId>
    <version>0.17</version>
</dependency>

Let me know if you need anything else :slight_smile:


(Casper Færgemand) #9

Yep, this works better than the oss.sonatype link, since it lets me get the source for easy browsing.

In the yet-to-be-released version, I assume the xjb files generate the missing classes?

Edit: I stopped trying to use gradle and accepted your maven solution. I got it to compile just fine.


(Casper Færgemand) #10

@mikethomas Both the original and your version seem to choke on maps that use tsx files that are not at the default path. In the current test code, create a new folder and copy desert.tmx and desert.tsx into it. Then add the following test case:

@Test
public void testErrorReadingMap() throws Exception {
    new TMXMapReader().readMap("other/desert.tmx");
}

It throws the an error like this in my code:

 java.lang.IndexOutOfBoundsException: Index: 16, Size: 1
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at tiled.core.TileSet.getTile(TileSet.java:419)
	at tiled.io.TMXMapReader.getTileForTileGID(TMXMapReader.java:727)
	at tiled.io.TMXMapReader.setTileAtFromTileId(TMXMapReader.java:713)
	at tiled.io.TMXMapReader.readLayer(TMXMapReader.java:626)
	at tiled.io.TMXMapReader.buildMap(TMXMapReader.java:812)
	at tiled.io.TMXMapReader.unmarshal(TMXMapReader.java:846)
	at tiled.io.TMXMapReader.readMap(TMXMapReader.java:873)

I think the issue is that the tsx file is on a path relative to the tmx file, but some other path is searched when the tsx file is attempted loaded. I recall an older version of the code having the same problem. It worked only when the resources were folders named the same as the package structure of the class from which the tmx file was attempted loaded. I’m looking through the source, but I haven’t found the problem yet.


(Thorbjørn Lindeijer) #11

It would be good to report such issues on the issue tracker.


(Casper Færgemand) #12

It is done.

https://github.com/bjorn/tiled/issues/1626