gwtproject / gwt-site

Sources of the pages of the gwtproject.org website.
150 stars 331 forks source link

Build the gwt-site with Maven doesn't work #332

Open lofidewanto opened 2 years ago

lofidewanto commented 2 years ago

Building with Maven only, as documented in the README doesn't work:

mvn clean install -Pgrunt

Instead I need to deactivate the tests:

mvn clean install -Pgrunt -DskipTests

niloc132 commented 2 years ago

Can you share the test failure? I have not seen these fail, in my very limited testing.

Locally:

[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ gwt-site ---
[INFO] Surefire report directory: /home/colin/workspace/gwt-site/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.google.gwt.site.markdown.MDTranslaterTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.163 sec

Results :

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

In a dedicated docker image to build this output (rather than downloading pre-built output), you can see we don't skip tests there either: https://github.com/Vertispan/gwtproject.org/blob/main/www/Dockerfile#L6-L15

lofidewanto commented 2 years ago

Java version:

openjdk version "17.0.3" 2022-04-19 LTS
OpenJDK Runtime Environment Zulu17.34+19-CA (build 17.0.3+7-LTS)
OpenJDK 64-Bit Server VM Zulu17.34+19-CA (build 17.0.3+7-LTS, mixed mode, sharing)

Maven version:

mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /Users/xxx/Applications/apache-maven-3.3.9
Java version: 17.0.3, vendor: Azul Systems, Inc.
Java home: /Users/xxx/.sdkman/candidates/java/17.0.3-zulu/zulu-17.jdk/Contents/Home
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "12.4", arch: "aarch64", family: "mac"

Here is my local build:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.google.gwt.site.markdown.MDTranslaterTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.028 sec <<< FAILURE!
testAdjustRelativePath(com.google.gwt.site.markdown.MDTranslaterTest)  Time elapsed: 0.015 sec  <<< ERROR!
java.lang.RuntimeException: Error creating extended parser class: Could not determine whether class 'org.pegdown.Parser$$parboiled' has already been loaded
        at org.parboiled.Parboiled.createParser(Parboiled.java:58)
        at org.pegdown.PegDownProcessor.<init>(PegDownProcessor.java:92)
        at org.pegdown.PegDownProcessor.<init>(PegDownProcessor.java:71)
        at com.google.gwt.site.markdown.MDTranslater.<init>(MDTranslater.java:35)
        at com.google.gwt.site.markdown.MDTranslaterTest.testAdjustRelativePath(MDTranslaterTest.java:22)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at junit.framework.TestCase.runTest(TestCase.java:177)
        at junit.framework.TestCase.runBare(TestCase.java:142)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:130)
        at junit.framework.TestSuite.runTest(TestSuite.java:241)
        at junit.framework.TestSuite.run(TestSuite.java:236)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
        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:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        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)
Caused by: java.lang.RuntimeException: Could not determine whether class 'org.pegdown.Parser$$parboiled' has already been loaded
        at org.parboiled.transform.AsmUtils.findLoadedClass(AsmUtils.java:213)
        at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:35)
        at org.parboiled.Parboiled.createParser(Parboiled.java:54)
        ... 29 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) accessible: module java.base does not "opens java.lang" to unnamed module @a803f94
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
        at org.parboiled.transform.AsmUtils.findLoadedClass(AsmUtils.java:206)
        ... 31 more

Results :

Tests in error: 
  testAdjustRelativePath(com.google.gwt.site.markdown.MDTranslaterTest): Error creating extended parser class: Could not determine whether class 'org.pegdown.Parser$$parboiled' has already been loaded

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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.156 s
[INFO] Finished at: 2022-06-12T00:32:50+02:00
[INFO] Final Memory: 18M/74M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project gwt-site: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/lofidewanto/git/gwt-site/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
lofidewanto commented 2 years ago

OK, I test again with Java 11. The test works with Java 11 but not with Java 17 (see above).

Maybe just write Java 11 as a condition?

keinhaar commented 1 year ago

@lofidewanto , @niloc132 I can confirm, that building with JAVA 17 does not work! Testet JAVA 8, which is working.

niloc132 commented 1 year ago

As long as 11 and 8 work, we're going to leave this as low priority. Patches definitely welcome to update our Pegdown impl, including replacing it with another markdown processor, in a way that doesn't substantially change our output.

Likely we could just add an --add-opens for java.lang too when invoking this, as a workaround.

keinhaar commented 1 year ago

With JAVA 17 you need to specify the _JAVA_OPTIONS like this: _JAVA_OPTIONS="--add-opens=java.base/java.lang=ALL-UNNAMED" mvn clean install -Pgrunt