asciidoctor / asciidoclet

:clipboard: A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.
https://github.com/asciidoctor/asciidoclet
Apache License 2.0
133 stars 39 forks source link

Upgrade both Asciidoclet to Java 11, and Asciidoctorj to version 2.1.0 #97

Closed chrisvest closed 5 years ago

chrisvest commented 5 years ago

This PR is based on #96 for the Java 11 upgrade.

When upgrading asciidoctorj to versoin 2.1.0, the build starts to fail as shown below. It looks like the JNR dependency of JRuby is not properly modularised, and causes Java package conflicts because both jnr-enxio and jnr-unixsocket define a jnr.enxio.channels package. In a modular Java world, two modules cannot both define the same package, even when they are anonymous modules.

Ping @mojavelinux & @headius.

I haven't yet checked if there are newer versions of JNR or JRuby that solves this already. I can do that later.

I also tried excluding either the unixsocket or the enxio dependencies in maven, but doing that causes NoClassDefFoundErrors, so both are clearly needed.

$ mvn clean install
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.asciidoctor:asciidoclet:jar:2.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 98, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] --------------------< org.asciidoctor:asciidoclet >---------------------
[INFO] Building AsciiDoc Javadoc Doclet 2.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ asciidoclet ---
[INFO] Deleting /home/chris/asciidoclet/target
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-maven) @ asciidoclet ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ asciidoclet ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ asciidoclet ---
[WARNING] ********************************************************************************************************************
[WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *
[WARNING] ********************************************************************************************************************
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to /home/chris/asciidoclet/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ asciidoclet ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/chris/asciidoclet/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ asciidoclet ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /home/chris/asciidoclet/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ asciidoclet ---
[INFO] Surefire report directory: /home/chris/asciidoclet/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.asciidoctor.asciidoclet.DocletOptionsTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.067 sec
Running org.asciidoctor.asciidoclet.StylesheetsTest
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec
Running org.asciidoctor.asciidoclet.JavadocParserTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.029 sec
Running org.asciidoctor.asciidoclet.AsciidocletIntegrationTest
error: the unnamed module reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jruby reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module org.jruby reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jnr.netdb reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jnr.enxio reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jnr.unixsocket reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jnr.posix reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jnr.constants reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jffi reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module dirgra reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module options reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jzlib reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module nailgun.server reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module joda.time reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module backport9 reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jruby.stdlib reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module jcommander reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module junit reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module hamcrest.core reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module asciidoctorj reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
error: module asciidoctorj.api reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
src/main/java/module-info.java:16: error: module asciidoclet reads package jnr.enxio.channels from both jnr.unixsocket and jnr.enxio
module asciidoclet {
^
22 errors
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.522 sec <<< FAILURE!
testJavadocIntegration(org.asciidoctor.asciidoclet.AsciidocletIntegrationTest)  Time elapsed: 0.521 sec  <<< FAILURE!
java.lang.AssertionError: expected:<0> but was:<1>
    at org.junit.Assert.fail(Assert.java:88)
    at org.junit.Assert.failNotEquals(Assert.java:834)
    at org.junit.Assert.assertEquals(Assert.java:645)
    at org.junit.Assert.assertEquals(Assert.java:631)
    at org.asciidoctor.asciidoclet.AsciidocletIntegrationTest.testJavadocIntegration(AsciidocletIntegrationTest.java:60)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Running org.asciidoctor.asciidoclet.AsciidoctorRendererTest
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules (file:/home/chris/.m2/repository/com/headius/backport9/1.2/backport9-1.2.jar) to field java.io.FileDescriptor.fd
WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.425 sec
Running org.asciidoctor.asciidoclet.AttributesLoaderTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.324 sec

Results :

Failed tests:   testJavadocIntegration(org.asciidoctor.asciidoclet.AsciidocletIntegrationTest): expected:<0> but was:<1>

Tests run: 34, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.078 s
[INFO] Finished at: 2019-07-25T09:58:30+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project asciidoclet: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/chris/asciidoclet/target/surefire-reports for the individual test results.
[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/MojoFailureException
$
mojavelinux commented 5 years ago

Thanks for taking this on!

The right people to ping are @johncarl81 and @msgilligan.

chrisvest commented 5 years ago

Also a ping for @robertpanzer in case he has seen this before.

msgilligan commented 5 years ago

Sorry I haven't had any time to help with this, but I should be able to test the ConsensusJ build. I just upgraded the Travis config so it can build with OpenJDK11 although I have it disabled because it's using old Asciidoclet. Here's the issue I created: https://github.com/ConsensusJ/consensusj/issues/55

LightGuard commented 5 years ago

Looks like there's some issues in the build? I haven't done anything with java modules yet, so I'm not sure.

chrisvest commented 5 years ago

Closing because I don't intend to pursue this one any further. #96 appears to work, and is enough for my purposes.