Fix to support JPMS by OpenHelios · Pull Request #334 · elastic/ecs-logging-java

Conversation

@OpenHelios

This is a fix for #332.

This change needs to update the dependency of logback-classic from 1.2.13 to 1.3.15, because 1.3.x is the first version, which supports JPMS, i.e. it includes the needed module-info file.

Only in the main project ecs-logging-core and in logback-ecs-encoder the module-info file has been added. Also in jul-ecs-formatter and log4j-* projects a module-info file could be added in a similar way.

@cla-checker-service

@OpenHelios OpenHelios changed the title Fix to suppert JPMS Fix to support JPMS

Jun 4, 2025

@OpenHelios

@SylvainJuge

The process to sign the contributor agreement does not work for me https://www.elastic.co/contributor-agreement Only the progress bar runs to end, but nothing more happens.

The commits are using OpenHelios@users.noreply.github.com as email adress, I am not 100% sure but this might be the issue here, could you try to use your non-anonymous email address here ?

@OpenHelios

I gave the signing process an other try by pushing the commits with my real email address. With Chromium and not with Firefox I was able to start the signing process, but at the end after clicking "Finish" I get the error message "apps.docusign.com hat die Verbindung abgelehnt.", which means translated to English, that the connection was rejected. What am i missing?
Now signing was successful.

@OpenHelios

Now the module names are named by the packages

  • co.elastic.logback and
  • co.elastic.logging.logback

@JonasKunz

Unfortunately I think the fix isn't that trivial, because we need to target java 7, which can't compile module-info.java.
A way of solving this would be to add separate maven subprojects with just the module-info.java, have those compiled against java 9 and shade them into the actual projects. Seems like a lot of work and complexity just to avoid the automodule-warning, which is safe to be ignored.

@OpenHelios

@OpenHelios

The first commit updates the dependency logback-classic from 1.2.13 to 1.3.15, because JPMS is introduced with 1.3.8. There are some changes from 1.2.13 to 1.3.15, which causes some failing tests.

Is it already planned to update logback-classic from 1.2.13 to a newer version?

@OpenHelios

Now everything is compiling and the module-info.class file is added to the jar file in esc-logging-core and logback-esc-encoder. An update of logback-classic is not needed for JPMS anymore. Nevertheless the version can be easily overridden by users of the library on their own.
There is one tricky thing in the Maven build, which removes the module-info.class file in phase process-test-resources and creates it again in prepare-package phase. Otherwise the test-compile phase fails in a second invocation of Maven in phase test-compile. If module-info.class exists in classes folder, the compiler automatically uses JPMS, but the needed test classes from the other project are not provided by module-info.class file.

Labels