getsentry / sentry-java

A Sentry SDK for Java, Android and other JVM languages.
https://docs.sentry.io/
MIT License
1.14k stars 431 forks source link

Java Platform Module System compatibility #945

Open 5force opened 3 years ago

5force commented 3 years ago

Platform: java --version openjdk 15 2020-09-15 OpenJDK Runtime Environment Zulu15.27+17-CA (build 15+36) OpenJDK 64-Bit Server VM Zulu15.27+17-CA (build 15+36, mixed mode, sharing)

IDE:

Build system: Maven -> embedded

Platform installed with: Maven Central

The version of the SDK:

io.sentry sentry 1.7.30

module-info.java of project module com.test { requires javafx.controls; requires java.net.http; requires org.controlsfx.controls; requires io.sentry; exports com.test; }


When I try to make self-contained installer by jpackage for my modular test project it ends with error: jdk.incubator.jpackage.internal.PackagerException: jlink failed with: Error: automatic module cannot be used with jlink: io.sentry from file:///C:/Users/....../sentry-1.7.30.jar Do you have any plans to make Sentry modular that includes module-info.class file?

marandaneto commented 3 years ago

apparently, we can do it using Gradle https://docs.gradle.org/current/samples/sample_java_modules_multi_project.html

5force commented 3 years ago

with Gradle and badass-jlink-plugin I have maked self-contained installer, but for now it's impossible using Maven and jpackage tool

talios commented 3 years ago

Would be nice to see this as part of any work to resurrect OSGi support (#983). Keeping the library JDK8 compatible for now should be of concern as well IMHO.

tlf30 commented 2 years ago

We are looking to migrate from JDK 11 to JDK 17, and this is a major blocker in our applications preventing the migration to java 9 modules. Can someone please look into this?

marandaneto commented 2 years ago

@tlf30 would you like to contribute with a PR?

https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_modular

maybe @maciejwalkowiak can guide you during the process, I'm not familiar with the Java platform module system yet

maciejwalkowiak commented 2 years ago

I have this issue on my todo list, but I will also need some time to dig into it as I haven't worked with JPMS yet. @tlf30 you're welcome to create a PR.

tlf30 commented 2 years ago

@maciejwalkowiak unfortunately the module system is fairly new to me as well. I have only been learning it these last couple weeks as my company pushes to move from jdk 11 to jdk 17. Our biggest motivator to use modular applications was jfx 16 requiring it, and we are heavily dependent on javafx.

I'm afraid that if I was to prepare a PR that i would overlook something important. I am already fighting that in my own applications.

osiegmar commented 1 month ago

The Java Platform Module System (JPMS) was released in 2017 as a core feature of Java 9.

It would be great if at least an Automatic-Module-Name could be added to the META-INF/MANIFEST.MF file of the Sentry's JAR files until the library is fully modularized.

StefanOltmann commented 3 weeks ago

Is this the reason why Sentry does not work if run from a build created with the org.beryx.jlink plugin?

osiegmar commented 3 weeks ago

Is this the reason why Sentry does not work if run from a build created with the org.beryx.jlink plugin?

Very likely, yes. From https://github.com/beryx/badass-jlink-plugin:

Using this Gradle plugin you can create a custom runtime image of your modular application with minimal effort, even if it depends on automatic modules.

Currently, Sentry does not support JPMS modules and does not even provide an automatic module name.

adinauer commented 6 days ago

We'll bump prio on this but I can't give an ETA on when we'll get to it.

StefanOltmann commented 6 days ago

Luckily I found a way to avoid the JPMS.

osiegmar commented 6 days ago

Luckily I found a way to avoid the JPMS.

Thanks for letting us know! 😉