Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libtiled-java incompatible with Java 11 #2048

Closed
carif opened this issue Dec 27, 2018 · 14 comments
Closed

libtiled-java incompatible with Java 11 #2048

carif opened this issue Dec 27, 2018 · 14 comments

Comments

@carif
Copy link

carif commented Dec 27, 2018

Using libtiled-java with Java 11 gives me the following error:
java.lang.NoClassDefFoundError: JAXBException

It seems to be caused by Java 11 removing java.xml.bind (JAXB).

@bjorn
Copy link
Member

bjorn commented Dec 27, 2018

I'd love to also drop JAXB from libtiled-java. But what does Java provide as an alternative?

@carif
Copy link
Author

carif commented Dec 28, 2018

I'd love to also drop JAXB from libtiled-java. But what does Java provide as an alternative?

Sadly I don't really now if Java provides an alternative at all as I've never worked with XML and/or JAXB in Java, but I stumbled across some information which might help you:
Thought maybe the following links provide helpful information: JEP 320 and JAXB Java 9 Doc

There seemed to be a way to use JAXB in Java 9 and 10, but it doesn't work in Java 11 anymore.

@bjorn
Copy link
Member

bjorn commented Jan 30, 2020

I don't know exactly how, since JAXB seems to be still used, but Java 11 compatibility was restored by #1925.

@bjorn bjorn closed this as completed Jan 30, 2020
@carif
Copy link
Author

carif commented Feb 3, 2020

I don't know exactly how, since JAXB seems to be still used, but Java 11 compatibility was restored by #1925.

I'm still affected by this problem. As it seems to work in the mentioned pull request, maybe it's a problem with my small example project I just created with Gradle? I'm not really familiar with Maven.
A minimal project which causes this problem for me: TiledLevelTest.zip. I'm using Eclipse 2019-12. gradlew eclipse will set the project up for eclipse.

@bjorn
Copy link
Member

bjorn commented Feb 3, 2020

@MinecraftPlaye Hmm, while this incompatibility problem is probably fixed, the version of libtiled on Maven Central has not been updated with those changes. Could that be causing problems? Or are you using libtiled-java from source?

@carif
Copy link
Author

carif commented Feb 3, 2020

@MinecraftPlaye Hmm, while this incompatibility problem is probably fixed, the version of libtiled on Maven Central has not been updated with those changes. Could that be causing problems? Or are you using libtiled-java from source?

I'm using the version from Maven Central.

@carif
Copy link
Author

carif commented Feb 13, 2020

Hmm, while this incompatibility problem is probably fixed, the version of libtiled on Maven Central has not been updated with those changes. Could that be causing problems?

Ok, after some time figuring out how Maven works I got this far with compiling the code from this repository's master branch:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project libtiled: There are test failures.

@bjorn
Copy link
Member

bjorn commented Feb 26, 2020

@MinecraftPlaye The version on Maven Central has now been updated. Could you verify whether this resolves your issue (and #2052)?

@carif
Copy link
Author

carif commented Mar 1, 2020

@MinecraftPlaye The version on Maven Central has now been updated. Could you verify whether this resolves your issue (and #2052)?

Ok, I just tested it with version 1.2.3 from Maven Central. I'm not sure if this is intended, but without any modifications to my projects it does not work. Adding the same dependency from the maven script of libtiled to all my projects which depend on libtiled solves the problem (tested with the TiledLevelTest.zip from above)

implementation group: 'org.mapeditor', name: 'libtiled', version: '1.2.3'
// required by libtiled
implementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.2'

@bjorn
Copy link
Member

bjorn commented Mar 1, 2020

@mikepthomas Is there a dependency we could add somewhere to avoid users like @MinecraftPlaye needing to add this?

@mikepthomas
Copy link
Contributor

https://github.com/bjorn/tiled/blob/master/util/java/libtiled-java/pom.xml#L151 This should add the dependencies for any version of Java over version 1.9... it seems to be working fine for tmxviewer-java fine however this is probably because it is a Maven project, I don’t have much experience with Gradle but my guess is that this profile is not being automatically enabled

@bjorn
Copy link
Member

bjorn commented Mar 2, 2020

@mikepthomas Alright, thanks for the quick answer!

@MinecraftPlaye Maybe you can figure out a way to make this work automatically also with Gradle? If not I guess it would be good to mention the need to add this dependency in the README.md.

@carif
Copy link
Author

carif commented Mar 14, 2020

@mikepthomas Alright, thanks for the quick answer!

@MinecraftPlaye Maybe you can figure out a way to make this work automatically also with Gradle? If not I guess it would be good to mention the need to add this dependency in the README.md.

Alright, I looked into it and could not find anything which resolves this problem. There are a few open issues on Gradle with Maven POM files regarding transitive dependencies, but as far as my understanding of Gradle and especially Maven goes, those are not the cause for this problem.

I did however found this while looking up the Gradle documentation: Gradle Module Metadata . You could potentially provide this file alongside the POM file. In that case Gradle would ignore the POM file and use the Module Metadata file.

@bjorn
Copy link
Member

bjorn commented Mar 14, 2020

@MinecraftPlaye Thanks for looking into it! If providing Gradle Module Metadata is a solution to this then I guess we'd be looking for somebody to maintain such a file. Or we can document the need to add this dependency for Gradle users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants