melix / mrjar-gradle

Example of how to produce a MRJAR with Gradle
Apache License 2.0
20 stars 5 forks source link

How to add module-info to a java9 build #4

Open Glavo opened 6 years ago

Glavo commented 6 years ago

When I try to place module-info.java in src/main/java9, Gradle will report an error at compile time:

src/main/java9/module-info.java:2: error: package is empty or does not exist: org.glavo.llvm4j.binding
    exports org.glavo.llvm4j.binding;
                            ^
1 error

Project package structure: image module-info.java:

module llvm4j {
    exports org.glavo.llvm4j.binding;
}
scholzi100 commented 4 years ago

Same problem, with Classpath this does work very well. As soon as switching to Module-Path problems start to appearer. @melix Is there some magic to perform to make this work?

melix commented 4 years ago

You can try a similar approach to what I've done in this project. This requires some dummy classes so that the Java compiler is happy.

Glavo commented 4 years ago

@scholzi100 @melix Now, I use the modularity.mixedJavaRelease fuction in gradle-modules-plugin plugin.

In addition, sometimes I will achieve this by modifying the version information in the bytecode, which can avoid some JDK related problems.