consulo / maven-consulo-plugin

Maven plugin for Packaging & Running Consulo
Apache License 2.0
2 stars 1 forks source link

Add Java 18 Build Support #10

Closed BlitDev closed 3 months ago

BlitDev commented 2 years ago

OpenJDK version 18 is already available in the repositories of the Arch Linux distribution, I would like to get support at the Maven level, otherwise the compiler gives warnings.

VISTALL commented 2 years ago

Hello. What warnings?

BlitDev commented 2 years ago
major version 62 is newer than 61, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.

while building some classes

BlitDev commented 2 years ago

Also, when trying to run Consulo as desktop on version 18, it does not start with an error:

    at consulo.platform.desktop//consulo.desktop.container.boot.DesktopContainerStartup.lambda$run$2(DesktopContainerStartup.java:83)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.invokeAtUIAndWait(DesktopApplicationStarter.java:317)
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.initApplication(DesktopApplicationStarter.java:120)
    at com.intellij//com.intellij.idea.ApplicationStarter.<init>(ApplicationStarter.java:81)
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.<init>(DesktopApplicationStarter.java:84)
    at consulo.platform.desktop//consulo.desktop.container.boot.DesktopContainerStartup.lambda$start$4(DesktopContainerStartup.java:119)
    at com.intellij//com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:108)
    at consulo.platform.desktop//consulo.desktop.container.boot.DesktopContainerStartup.start(DesktopContainerStartup.java:118)
    at consulo.platform.desktop//consulo.desktop.container.boot.DesktopContainerStartup.lambda$run$2(DesktopContainerStartup.java:80)
    ... 1 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1371)
    at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1346)
    at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.invokeAtUIAndWait(DesktopApplicationStarter.java:314)
    ... 8 more
Caused by: java.lang.ExceptionInInitializerError
    at com.intellij//com.intellij.ide.IdeEventQueue.<clinit>(IdeEventQueue.java:88)
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.lambda$initApplication$0(DesktopApplicationStarter.java:123)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.Runnable java.awt.event.InvocationEvent.runnable accessible: module java.desktop does not "opens java.awt.event" to unnamed module @248be894
    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.Field.checkCanSetAccessible(Field.java:180)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:174)
    at com.intellij//consulo.awt.hacking.InvocationUtil.findRunnableField(InvocationUtil.java:47)
    at com.intellij//consulo.awt.hacking.InvocationUtil.<clinit>(InvocationUtil.java:15)

If you run it from the consulo-bundle archive, everything works.

VISTALL commented 2 years ago

via maven consulo:run-desktop?

major version 62 is newer than 61, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.

while building some classes

hm, strange. will test

Also, when trying to run Consulo as desktop on version 18, it does not start with an error:

    at consulo.platform.desktop//consulo.desktop.container.boot.DesktopContainerStartup.lambda$run$2(DesktopContainerStartup.java:83)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.invokeAtUIAndWait(DesktopApplicationStarter.java:317)
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.initApplication(DesktopApplicationStarter.java:120)
    at com.intellij//com.intellij.idea.ApplicationStarter.<init>(ApplicationStarter.java:81)
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.<init>(DesktopApplicationStarter.java:84)
    at consulo.platform.desktop//consulo.desktop.container.boot.DesktopContainerStartup.lambda$start$4(DesktopContainerStartup.java:119)
    at com.intellij//com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:108)
    at consulo.platform.desktop//consulo.desktop.container.boot.DesktopContainerStartup.start(DesktopContainerStartup.java:118)
    at consulo.platform.desktop//consulo.desktop.container.boot.DesktopContainerStartup.lambda$run$2(DesktopContainerStartup.java:80)
    ... 1 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1371)
    at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1346)
    at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.invokeAtUIAndWait(DesktopApplicationStarter.java:314)
    ... 8 more
Caused by: java.lang.ExceptionInInitializerError
    at com.intellij//com.intellij.ide.IdeEventQueue.<clinit>(IdeEventQueue.java:88)
    at consulo.platform.desktop//com.intellij.idea.starter.DesktopApplicationStarter.lambda$initApplication$0(DesktopApplicationStarter.java:123)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.Runnable java.awt.event.InvocationEvent.runnable accessible: module java.desktop does not "opens java.awt.event" to unnamed module @248be894
    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.Field.checkCanSetAccessible(Field.java:180)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:174)
    at com.intellij//consulo.awt.hacking.InvocationUtil.findRunnableField(InvocationUtil.java:47)
    at com.intellij//consulo.awt.hacking.InvocationUtil.<clinit>(InvocationUtil.java:15)

If you run it from the consulo-bundle archive, everything works.

while consulo:run-desktop ?

VISTALL commented 2 years ago

If yes - need add some maven options for run it. After jdk 17 some VM options need to added to command line.

I'm not documented it, since master branch running at JDK11.

Valhalla branch based on JDK17, and I will add all info about it

BlitDev commented 2 years ago

Yes, I entered mvn consulo:run-desktop -xpl consulo:consulo-sandbox-desktop

VISTALL commented 2 years ago

For now I recommend use jdk before 17 (due https://openjdk.org/jeps/403)

Inside Consulo codebase we have some hacks to AWT/Swing implementations, which require add '--add-opens' to jvm args, due locked internals after jdk 17.

Consulo&plugins works well with jdk 17+ but, maven runs without options, and failed to start.

Better use jdk11, or I will later write here MAVEN_OPTS env value, which contains --add-opens options (and you willl need export it)

VISTALL commented 2 years ago

You need define MAVEN_OPTS env variable

--add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED --add-opens=java.desktop/sun.java2d=ALL-UNNAMED --add-opens=java.desktop/sun.font=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED --add-opens=java.desktop/java.awt.event=ALL-UNNAMED
VISTALL commented 2 years ago

Since there a problem running Consulo after 17 + inside maven, need add

run-desktop-awt-fork

which running Consulo in separate process, with correct vm options