asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
285 stars 120 forks source link

WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem #666

Open athspk opened 1 year ago

athspk commented 1 year ago

Versions:

id "org.asciidoctor.jvm.convert" version "3.3.2" gradle version 7.6.1

Task raw output:

Running the asciidoctor task with ./gradlew asciidoctor --warning-mode=all returned the following warnings in raw output:

$ ./gradlew asciidoctor --warning-mode=all --rerun-tasks

> Configure project :
Will run tests on 2 cores, restarting each process after 50 test classes

> Task :asciidoctor
Relying on FileTrees for ignoring empty directories when using @SkipWhenEmpty has been deprecated. This is scheduled to be removed in Gradle 8.0. Annotate the property sourceFileTree with @IgnoreEmptyDirectories or remove @SkipWhenEmpty. Consult the upgrading guide for further information: https://docs.gradle.org/7.6.1/userguide/upgrading_version_7.html#empty_directories_file_tree
The JavaExecHandleBuilder.setMain(String) method has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the mainClass property instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.6.1/userguide/upgrading_version_7.html#java_exec_properties
2023-03-14T09:26:53.061-04:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.

BUILD SUCCESSFUL in 6s
1 actionable task: 1 executed

Warnings:

So I see 3 warnings here (2 deprecation and 1 weird warning).

A.

Relying on FileTrees for ignoring empty directories when using @SkipWhenEmpty has been deprecated. 
This is scheduled to be removed in Gradle 8.0. 
Annotate the property sourceFileTree with @IgnoreEmptyDirectories or remove @SkipWhenEmpty. 
Consult the upgrading guide for further information: 

https://docs.gradle.org/7.6.1/userguide/upgrading_version_7.html#empty_directories_file_tree ADDRESSED IN: https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/641 , https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/629

B.

The JavaExecHandleBuilder.setMain(String) method has been deprecated. 
This is scheduled to be removed in Gradle 8.0. 
Please use the mainClass property instead. 
Consult the upgrading guide for further information: 

https://docs.gradle.org/7.6.1/userguide/upgrading_version_7.html#java_exec_properties ADDRESSED IN: https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/602 , https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/611

C.

2023-03-14T09:26:53.061-04:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.

This is the warning for which I opened this issue.
My other gradle tasks don't produce this warning, only the asciidoctor task.
I tried to google the 'FilenoUtil' warning line and the results didn't even have to do with either gradle or asciidoctor.
When I run the task with --info I saw in the classpath of the execution of AsciidoctorJavaExec using jruby, which is on the the results I mentioned above.
Also, oddly enough, I added both --add-opens packages but still saw the warning.
Please advise.
Thank you for your time :-)

zhangt2333 commented 1 year ago

I use the following workaround to suppress the warning C in build.gradle.kts:

tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask::class) {
    forkOptions {
        jvmArgs(listOf(
            "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
            "--add-opens", "java.base/java.io=ALL-UNNAMED",
        ))
    }
}
ummels commented 4 months ago

After upgrading to version 4 of the plugin, the workaround mentioned by @zhangt2333 does not seem to work any more. (forkOptions has been renamed to jvm, but the problem persists after renaming.)

tkrah commented 3 months ago

Same problem here, passing via JDK_JAVA_OPTIONS or with:


tasks.withType(AbstractAsciidoctorTask).configureEach {
    jvm {
        jvmArgs("--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")
    }
}

does not help anymore to fix that error.

Task :manual:asciidoctorPdf 2024-04-26T14:14:55.107+02:00 [WorkerExecutor Queue] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.

vogella commented 3 months ago

I see also the warning if I try to update the asciidoctor-gradle-examples/asciidoc-to-html-example to Gradle 8.6

Changes I did in build.gradle

plugins {
    id 'org.asciidoctor.jvm.convert' version '4.0.2'
}

And ingradle/wrapper/gradle-wrapper.properties

#Wed Jan 29 14:51:02 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip

Warning:

vogella@laptoplars:~/git/asciidoctor-gradle-examples/asciidoc-to-html-example$ ./gradlew asciidoctor
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details

> Task :asciidoctor
2024-05-02T09:18:20.438+02:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.

The HTML output is still created.