Add a JPMS module descriptor
I already tried to, but I cam back with a little more knowledge
Please add a Java 9+ JPMS module descriptor. PR will follow.
Technical details of the upcoming PR
- Add a java9+
<profile><id>java9</id></profile>
- In this profile, the folder
src/main/java9
is added as an additional source folder - The source folder contains a
module-info.java
.
This will require a JDK9+ for compilation, but the whole rest of the source code will still produce java8 bytecode. I.e. no compatiblity issues.
The only file which will be compiled to Java9+ is the module descriptor. It will transparently be included in the resulting jar archive.
We do this in the maven-jlink-plugin
the same way. A lot of plexus maven plugins do this as well.
Jlink example:
- 9+ Source code: https://github.com/apache/maven-jlink-plugin/tree/master/src/main/java9/org/apache/maven/plugins/jlink
- 9+ pom profile: https://github.com/apache/maven-jlink-plugin/blob/master/pom.xml#L201-L247
Benefit / User stories
Applications requiring snakeyaml
will be able to be packed into a jlink
or jpackage
archive, or even easier with the client-maven-plugin
for gluon. At the moment this will not work, as at least jlink and jpackage require all dependencies to be modules.
Comments (10)
-
-
reporter Hi Andrey, it does not really matter if it is Java 7 or 8. The only difference will be that there is a new
META-INF/java9
directory in the jar file, containing amodule-info.java
.What is “Engine”?
-
I see you mention
client-maven-plugin
plugin. So, I expect you want to cross-platform application (like Android maybe).
But android version and non-android version would need to have differentmodule-info.java
files (e.g. android one does not require java.desktop).I think making multirelease jar should not be a problem, since
maven-compile-plugin
supports it.But I am not sure should we really do it in this project.
I guess it is also possible to use https://github.com/moditect/moditect to injectmodule-info.class
for the dependencies missing it. -
Engine - https://bitbucket.org/asomov/snakeyaml-engine (YAML 1.2 and Java8+)
-
reporter I am not able to get the tests working I could upload a draft PR if you wish.
Btw: I do not think snakeyaml requires
java.desktop
at all. -
./mvnw clean install
./docker-run-jdk7.sh -
reporter About snakeyaml-engine: Oh great! I didn’t know about that! I will now convert to snakeyaml-engine.
You are right that this issue will not make sense here. Thanks for the clarification!
-
reporter - changed status to wontfix
Makes no sense here, users should update to snakeyaml-engine first.
-
SnakeYAML Engine has different API (no magic to support JavaBeans)
-
@Benjamin Marwell snakeyaml uses Introspection which uses
java.beans
package which is part ofjava.desktop
https://docs.oracle.com/javase/9/docs/api/java.desktop-summary.html - Log in to comment
Please be aware that SnakeYAML is under Java 7 (not Java 8)
I am afraid it will create compatibility issues.
Why not to migrate to Engine ? And implement this there ?