download gems, and then threw an error
I generated a project from https://github.com/diguage/yongle at GitHub. Run mvn package for yongle, it is OK. But run mvn package for new project, it threw an error(the log is as following)
If I copy the gems to the config path, then it is OK.
$ java -version
NOTE: Picked up JDK_JAVA_OPTIONS: -Djava.io.tmpdir=/tmp -XX:+PrintCommandLineFlags
-XX:ConcGCThreads=3 -XX:G1ConcRefinementThreads=10 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=536870912 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=8589934592 -XX:MinHeapSize=6815736 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UseCompressedOops -XX:+UseG1GC
openjdk version "21.0.7" 2025-04-15 LTS
OpenJDK Runtime Environment Corretto-21.0.7.6.1 (build 21.0.7+6-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.7.6.1 (build 21.0.7+6-LTS, mixed mode, sharing)
$ mvn -v
NOTE: Picked up JDK_JAVA_OPTIONS: -Djava.io.tmpdir=/tmp -XX:+PrintCommandLineFlags
-XX:ConcGCThreads=3 -XX:G1ConcRefinementThreads=10 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=536870912 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=8589934592 -XX:MinHeapSize=6815736 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UseCompressedOops -XX:+UseG1GC
Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Maven home: /Users/diguage/.sdkman/candidates/maven/current
Java version: 21.0.7, vendor: Amazon.com Inc., runtime: /Users/diguage/.sdkman/candidates/java/21.0.7-amzn
Default locale: en_CN, platform encoding: UTF-8
OS name: "mac os x", version: "15.3", arch: "x86_64", family: "mac"
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.527 s (Wall Clock)
[INFO] Finished at: 2025-05-12T20:08:53+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jruby.maven:gem-maven-plugin:3.0.5:initialize (install-gems) on project yongle: Execution install-gems of goal org.jruby.maven:gem-maven-plugin:3.0.5:initialize failed: For input string: "-XX:G1ConcRefinementThreads=10" -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jruby.maven:gem-maven-plugin:3.0.5:initialize (install-gems) on project yongle: Execution install-gems of goal org.jruby.maven:gem-maven-plugin:3.0.5:initialize failed: For input string: "-XX:G1ConcRefinementThreads=10"
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution install-gems of goal org.jruby.maven:gem-maven-plugin:3.0.5:initialize failed: For input string: "-XX:G1ConcRefinementThreads=10"
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
Caused by: java.lang.NumberFormatException: For input string: "-XX:G1ConcRefinementThreads=10"
at java.lang.NumberFormatException.forInputString (NumberFormatException.java:67)
at java.lang.Integer.parseInt (Integer.java:662)
at java.lang.Integer.parseInt (Integer.java:778)
at de.saumya.mojo.ruby.script.JRubyVersion.extractVersionComponents (JRubyVersion.java:43)
at de.saumya.mojo.ruby.script.JRubyVersion.isVersionLowerThan (JRubyVersion.java:25)
at de.saumya.mojo.ruby.gems.GemsInstaller.maybeAddArtifact (GemsInstaller.java:245)
at de.saumya.mojo.ruby.gems.GemsInstaller.installGems (GemsInstaller.java:144)
at de.saumya.mojo.ruby.gems.GemsInstaller.installGems (GemsInstaller.java:115)
at de.saumya.mojo.ruby.gems.GemsInstaller.installGems (GemsInstaller.java:103)
at de.saumya.mojo.ruby.gems.GemsInstaller.installPom (GemsInstaller.java:62)
at de.saumya.mojo.gem.AbstractGemMojo.executeJRuby (AbstractGemMojo.java:373)
at de.saumya.mojo.jruby.AbstractJRubyMojo.execute (AbstractJRubyMojo.java:293)
at de.saumya.mojo.gem.AbstractGemMojo.execute (AbstractGemMojo.java:233)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
https://github.com/asciidoctor/asciidoctorj/issues/1299
Looks like it's processing the Java command line arguments and expecting them to be a version number? It picks up your G1 flag and doesn't know how to handle it.
Could you push a repo with an example project so I can try to reproduce it here?
@headius First of all, thank you very much.
After many experiments, I found that there would be an error when installing locally, but no error when running in GitHub Action. There is no problem downloading Java dependencies (mvn) and Ruby dependencies (gem) on my local network.
https://github.com/diguage/yongle is a sample project. https://github.com/diguage/yongle/actions/runs/15843536807/job/44660564497 is the latest GitHub Action run log. (install gem on the Build phase)
This may be a network problem, but I am not completely sure yet.
Thanks again.
@diguage The line of concern in your sample output is this one:
NOTE: Picked up JDK_JAVA_OPTIONS: -Djava.io.tmpdir=/tmp -XX:+PrintCommandLineFlags
-XX:ConcGCThreads=3 -XX:G1ConcRefinementThreads=10 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=536870912 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=8589934592 -XX:MinHeapSize=6815736 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UseCompressedOops -XX:+UseG1GC
Those flags are getting passed to Maven and somehow picked up by the JRuby gem plugin and misinterpreted as a version string. You likely have that environment variable set locally but not on GHA.
This is still probably a bug (I have no idea why it would try to process this flag as a version string) but removing that env would probably fix it for you locally.
@headius I cleaned the JDK_JAVA_OPTIONS variable, deleted the downloaded gems, and then built the document.
it is now okay: the gems were downloaded and the document was converted.
I am not sure how those flags would get interpreted by the Maven plugin as being JRuby arguments. It's very peculiar. I'll poke around a bit.
Ok I think I understand what happened here.
When JDK_JAVA_OPTIONS is set in the env, the JVM itself will warn about it:
[] jruby $ jruby -v
jruby 10.0.1.0-SNAPSHOT (3.4.2) 2025-07-09 554704dc38 OpenJDK 64-Bit Server VM 21.0.5+11-LTS on 21.0.5+11-LTS +indy +jit [arm64-darwin]
[] jruby $ JDK_JAVA_OPTIONS=-Xmx500m jruby -v
NOTE: Picked up JDK_JAVA_OPTIONS: -Xmx500m
jruby 10.0.1.0-SNAPSHOT (3.4.2) 2025-07-09 554704dc38 OpenJDK 64-Bit Server VM 21.0.5+11-LTS on 21.0.5+11-LTS +indy +jit [arm64-darwin]
The logic in jruby-maven-plugins for determining the JRuby version does so by running a JRuby subprocess and passing the -v flag. If the JDK_JAVA_OPTIONS flag is set, it incorrectly interprets the result as being the JRuby version string.
https://github.com/jruby/jruby-maven-plugins/blob/55f8be4a8865fd6389889ad08172788bbbe6c145/ruby-tools/src/main/java/de/saumya/mojo/ruby/script/ScriptFactory.java#L210-L215
We can make the version logic more robust so it does not misinterpret the output (or better yet, checks version without launching JRuby).
Well I have a fix for this, but the test doesn't fail because I can't reproduce the issue. It seems like the Picked up JDK_JAVA_OPTIONS line is being output to stderr for my JDK, which means it doesn't end up in the parsed JRuby version output.
See #142 for the fix and test.
@diguage Perhaps you could check whether the JDK you used is routing that warning message to stdout? The following command line should output nothing.
$ JDK_JAVA_OPTIONS=-Xmx1G java -version 2> /dev/null
If it outputs the warning then there's something special about your JDK.
@headius Thank you very much.
# BellSoft Liberica JDK
$ java -version
openjdk version "21.0.7" 2025-04-15 LTS
OpenJDK Runtime Environment (build 21.0.7+9-LTS)
OpenJDK 64-Bit Server VM (build 21.0.7+9-LTS, mixed mode, sharing)
$ JDK_JAVA_OPTIONS=-Xmx1G java -version 2> /dev/null
# No output
$ echo $?
0
# Amazon Corretto JDK -- My most commonly used JDK
$ sdk default java 21.0.7-amzn
setting java 21.0.7-amzn as the default version for all shells.
$ java -version
openjdk version "21.0.7" 2025-04-15 LTS
OpenJDK Runtime Environment Corretto-21.0.7.6.1 (build 21.0.7+6-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.7.6.1 (build 21.0.7+6-LTS, mixed mode, sharing)
$ JDK_JAVA_OPTIONS=-Xmx1G java -version 2> /dev/null
# No output
$ echo $?
0