How to use Java EE: Web classes in 2021.2

Answered

With upgrading to 2021.2 some dependencies from the Java EE: Web (com.intellij.javaee.web) were removed

import com.intellij.javaee.web.WebUtil;
import com.intellij.javaee.web.facet.WebFacet;
import com.intellij.psi.impl.source.jsp.WebDirectoryUtil;
import com.intellij.psi.impl.source.resolve.reference.impl.providers.WebPathReferenceProvider;

This was probably due to the announced unbundling: https://plugins.jetbrains.com/docs/intellij/api-notable-list-2021.html#notable-changes-in-intellij-idea-20212

What is the migration path for these removed classes? Do I need new module dependencies?

Current plattform plugins:

platformPlugins = com.intellij.java,com.intellij.jsp,com.intellij.spring,com.intellij.javaee.web,com.intellij.css
6 comments
Comment actions Permalink

After unbundling plugins from the IDE, you have to set a dependency to them manually – i.e., to include Java EE: Enterprise Java Beans (EJB) plugin in your build, add its ID (com.intellij.javaee.ejb) both to the Gradle properties (platformPlugins property) and plugin.xml.

0
Comment actions Permalink

Thanks for your answer, unfortunately this does not work for me. IntelliJ does not find this plugin.

platformPlugins = com.intellij.java,com.intellij.jsp,com.intellij.spring,com.intellij.javaee.web,com.intellij.javaee.ejb,com.intellij.css

Cannot find builtin plugin 'com.intellij.javaee.ejb' for IDE: C:\Users\martin.hofmann-sobik\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.idea\ideaIU\2021.2\31f9496f635cec87427837101e04cbcddfb544d7\ideaIU-2021.2

<depends>com.intellij.modules.ultimate</depends>
<depends>com.intellij.modules.java</depends>
<depends>com.intellij.jsp</depends>
<depends>com.intellij.spring</depends>
<depends>com.intellij.javaee.web</depends>
<depends>com.intellij.javaee.ejb</depends>
<depends>com.intellij.css</depends>

ejb is also not part of the code completion and marked red in the plugin.xml.

The error message says that it cannot find a builtin plugin, after unbundling its probably not a builtin plugin any more. Do I have to reference not builtin plugins different or enable their usage?

You said that theses classes moved to ejb module. How can I find out such information by myself: Which classes reside in which module. This is easy for Community Edition, but how to do this for the non open source part?

0
Comment actions Permalink

When referring to plugins which are _not_ bundled (like com.intellij.javaee.ejb), you must specify compatible version number explicitly in Gradle dependencies.
https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#locating-plugin-id-and-preparing-sandbox

0
Comment actions Permalink

Thanks Yann, that brought me one step further. After adding the EJB version and also the transitive JPA dependency of EJB IntelliJ can build the project and I can start runIde.

But unfortunately buildPlugin still fails at task buildSearchableOptions:

2021-09-07 15:13:20,664 [ 21504] ERROR - nSystem.impl.ActionManagerImpl - Cannot create class com.intellij.javaee.ejb.ql.GenerateEJBFinderOrSelectorMethod (classloader=PluginClassLoader(plugin=PluginDescriptor(name=Java EE: Enterprise Java Beans (EJB), id=com.intellij.javaee.ejb, descriptorPath=intellij.javaee.ejb.impl.jpa.xml, path=/mnt/c/dev/gitlab/c24-intellistripes/build/idea-sandbox/plugins/EJB, version=212.4746.2, package=com.intellij.javaee.ejb.ql), packagePrefix=com.intellij.javaee.ejb.ql., instanceId=158, state=active))
com.intellij.diagnostic.PluginException: Cannot create class com.intellij.javaee.ejb.ql.GenerateEJBFinderOrSelectorMethod (classloader=PluginClassLoader(plugin=PluginDescriptor(name=Java EE: Enterprise Java Beans (EJB), id=com.intellij.javaee.ejb, descriptorPath=intellij.javaee.ejb.impl.jpa.xml, path=/mnt/c/dev/gitlab/c24-intellistripes/build/idea-sandbox/plugins/EJB, version=212.4746.2, package=com.intellij.javaee.ejb.ql), packagePrefix=com.intellij.javaee.ejb.ql., instanceId=158, state=active))
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:870)
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:887)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.instantiate(ActionManagerImpl.java:195)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.convertStub(ActionManagerImpl.java:180)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getActionImpl(ActionManagerImpl.java:512)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getAction(ActionManagerImpl.java:501)
at com.intellij.ide.ui.search.TraverseUIStarter.processKeymap(TraverseUIStarter.java:267)
at com.intellij.ide.ui.search.TraverseUIStarter.startup(TraverseUIStarter.java:128)
at com.intellij.ide.ui.search.TraverseUIStarter.main(TraverseUIStarter.java:88)
at com.intellij.idea.ApplicationLoader$startApp$3.run(ApplicationLoader.kt:185)
at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:783)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1742)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1728)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool.awaitQuiescence(ForkJoinPool.java:2984)
at com.intellij.idea.StartupUtil.start(StartupUtil.java:294)
at com.intellij.idea.Main.bootstrap(Main.java:123)
at com.intellij.idea.Main.main(Main.java:84)
Caused by: java.lang.NoClassDefFoundError: com/intellij/jpa/ql/model/QlModel
at com.intellij.javaee.ejb.ql.GenerateEJBFinderOrSelectorMethod.<init>(GenerateEJBFinderOrSelectorMethod.java:26)
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:830)
... 18 more

 

Any ideas? Is there a different classpath for building and running? How can I debug/log the classpath?

 

Relevant project information:

non bundled EJB plugin now there

build/idea-sandbox/plugins

build/idea-sandbox/plugins
├── EJB
│   └── lib
│   └── ejb-support.jar
├── IntelliStripes-NV
│   └── lib
│   └── IntelliStripes-NV-0.2.20210907.jar
├── meta
│   ├── 128749.json
│   ├── 128749.json.etag
│   ├── 128832.json
│   └── 128832.json.etag
├── pluginsXMLIds.json
└── pluginsXMLIds.json.etag

Due to the fixed EJB dependency I had to pin the compatiblity range to 2021.2 only.

gradle.properties

pluginSinceBuild = 212
pluginUntilBuild = 212.*
pluginVerifierIdeVersions = IU-2021.2
platformPlugins = com.intellij.java,com.intellij.jsp,com.intellij.spring,com.intellij.javaee.web,com.intellij.javaee.jpa,com.intellij.javaee.ejb:212.4746.2,com.intellij.css

plugin.xml

<depends>com.intellij.modules.ultimate</depends>
<depends>com.intellij.modules.java</depends>
<depends>com.intellij.jsp</depends>
<depends>com.intellij.spring</depends>
<depends>com.intellij.javaee.web</depends>
<depends>com.intellij.javaee.jpa</depends>
<depends>com.intellij.javaee.ejb</depends>
<depends>com.intellij.css</depends>

 

0
Comment actions Permalink

If you don't require searchable options, you can disable it completely https://github.com/JetBrains/gradle-intellij-plugin/blob/master/FAQ.md#how-to-disable-building-searchable-options

JPA plugin itself has these dependencies, please try adding missing ones as well

<dependencies>
<plugin id="com.intellij.java"/>
<plugin id="com.intellij.modules.xml"/>
<plugin id="com.intellij.java-i18n"/>
<plugin id="com.intellij.properties"/>
<plugin id="com.intellij.javaee"/>
<plugin id="com.intellij.persistence"/>
<plugin id="com.intellij.database"/>
<plugin id="com.intellij.css"/>
<plugin id="com.intellij.modules.ultimate"/>
</dependencies>
0
Comment actions Permalink

Disabling searchable options solved my problem. Didn't expect that it is an optional task. Thanks a lot for your help.

For others which read this, here's also the Kotlin DSL variant:

tasks.getByName("buildSearchableOptions").enabled = false

 

0

Please sign in to leave a comment.