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

Publish with Module support in Maven Repository #40

Open
prisme60 opened this issue Apr 28, 2022 · 4 comments
Open

Publish with Module support in Maven Repository #40

prisme60 opened this issue Apr 28, 2022 · 4 comments

Comments

@prisme60
Copy link

prisme60 commented Apr 28, 2022

Please publish a version with module support.

I have the following error when I use your maven dependency :

/usr/lib/jvm/jre-17-openjdk/bin/java -Dmaven.multiModuleProjectDirectory=/home/user/ods_test -Dmaven.home=/home/user/idea-IC-213.6461.79/plugins/maven/lib/maven3 -Dclassworlds.conf=/home/user/idea-IC-213.6461.79/plugins/maven/lib/maven3/bin/m2.conf -Dmaven.ext.class.path=/home/user/idea-IC-213.6461.79/plugins/maven/lib/maven-event-listener.jar -javaagent:/home/user/idea-IC-213.6461.79/lib/idea_rt.jar=36873:/home/user/idea-IC-213.6461.79/bin -Dfile.encoding=UTF-8 -classpath /home/user/idea-IC-213.6461.79/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar:/home/user/idea-IC-213.6461.79/plugins/maven/lib/maven3/boot/plexus-classworlds.license org.codehaus.classworlds.Launcher -Didea.version=2022.1 org.apache.maven.plugins:maven-jlink-plugin:3.1.0:jlink
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< org.atis.ods:ods_test >------------------------
[INFO] Building ods_test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-jlink-plugin:3.1.0:jlink (default-cli) @ ods_test ---
[INFO]  -> module: com.github.miachm.sods ( /home/user/.m2/repository/com/github/miachm/sods/SODS/1.4.0/SODS-1.4.0.jar )
[ERROR] 
[ERROR] Error: automatic module cannot be used with jlink: com.github.miachm.sods from file:///home/user/.m2/repository/com/github/miachm/sods/SODS/1.4.0/SODS-1.4.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.933 s
[INFO] Finished at: 2022-04-28T11:38:38+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jlink-plugin:3.1.0:jlink (default-cli) on project ods_test: 
[ERROR] Exit code: 1
[ERROR] Command line was: jlink [--module-path, /home/user/.m2/repository/com/github/miachm/sods/SODS/1.4.0/SODS-1.4.0.jar, --add-modules, com.github.miachm.sods, --output, /home/user/ods_test/target/maven-jlink/default]
[ERROR] 
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Process finished with exit code 1

I am using the following versions of java and Maven :

[user@centos ~]$ java -version
openjdk version "17.0.2" 2022-01-18 LTS
OpenJDK Runtime Environment 21.9 (build 17.0.2+8-LTS)
OpenJDK 64-Bit Server VM 21.9 (build 17.0.2+8-LTS, mixed mode, sharing)
[user@centos ~]$ JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.2.0.8-15.el8.x86_64 mvn --version
Apache Maven 3.5.4 (Red Hat 3.5.4-5)
Maven home: /usr/share/maven
Java version: 17.0.2, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.2.0.8-15.el8.x86_64
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-383.el8.x86_64", arch: "amd64", family: "unix"

After some investigation, I see that there is a module-info.java, but the version 1.4.0 was published before the commit.
But even if you publish a new release, it is seems that the module will be not present (I do a test with JitPack, the profile JDK9 is not activated by default).

Edit : I am using Maven embedded in Intellij (maven 3.8.1), not from my system.

I have recompiled myself your SODS code and install it to my local maven repository (~/.m2), and I am now able to build the JLINK image.

Please release a version with module in the Maven repository.

@github-actions
Copy link

Thanks for your report! Please ensure you have provided enough info in order to recreate the issue, including the problematic ODS File.' first issue

@prisme60 prisme60 changed the title Publish SODS with Module support. Publish with Module support in Maven Repository Apr 28, 2022
@miachm
Copy link
Owner

miachm commented Apr 29, 2022

Hi,

Originally SODS was designed for JDK8. So I am compiling all the releases with a JDK8. That might explain why it is not compatible with the module system of JDK9.

The module-info was added after 1.4.0 release thanks to a contributor. I might need to drop JDK8 compatibility in order to enable it.

Let's see what I can do

@miasma
Copy link
Contributor

miasma commented Jul 2, 2022

Hi,

So I am compiling all the releases with a JDK8. That might explain why it is not compatible with the module system of JDK9.

Isn't the GitHub CI task using JDK11? It should be able to compile the multi-release JAR so that the module-info.class targets JDK9 bytecode and other class files JDK8 bytecode.

@miachm
Copy link
Owner

miachm commented Jul 2, 2022

Hi,
So I am compiling all the releases with a JDK8. That might explain why it is not compatible with the module system of JDK9.

Isn't the GitHub CI task using JDK11? It should be able to compile the multi-release JAR so that the module-info.class targets JDK9 bytecode and other class files JDK8 bytecode.

That's a good point. Right now I am compiling the releases in my own machine. The future should be using Github Actions

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

No branches or pull requests

3 participants