[JBoss] Control+Click not working in Eclipse after migration to Jakarta EE

Discussão em 'StackOverflow' iniciado por Stack, Setembro 16, 2024.

  1. Stack

    Stack Membro Participativo

    I recently migrated project from javax to Jakarta EE v10, jdk 11 to 17, and Tomcat 10.1, primefaces v13

    In earlier project, when I opened .xhtml files, and pressed control and clicked on any java class or method, it used to navigate to that specific method/file.

    After migration, this has stopped working and so is code assist in xhtml files for java classes/methods.

    My classes are defined as:

    import jakarta.inject.Named;
    import org.springframework.web.context.annotation.SessionScope;

    @Named(LoginWorkBean.NAME)
    @SessionScope
    public class LoginWorkBean {
    private static final long serialVersionUID = 2383439018xL;
    public static final String NAME = "loginWorkBean";
    public String userName; //and getters and setters
    }


    xhtml files:
    Here, earlier, If I pressed ctrl and click on loginWorkBean it will take me to above class. Now, after migration, this has stopped working, it throws no error/exceptions.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:eek:="http://omnifaces.org/ui" xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition>
    <h:eek:utputText
    value="#{loginWorkBean.userName}"
    styleClass="bold" escape="false" />
    </ui:composition>
    </html>


    faces-config.xhtml:

    <?xml version="1.0" encoding="UTF-8"?>
    <faces-config xmlns="https://jakarta.ee/xml/ns/jakartaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
    https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_4_0.xsd"
    version="4.0">
    </faces-config>


    web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://jakarta.ee/xml/ns/jakartaee"
    xmlns:web="http://xmlns.jcp.org/xml/ns/javaee"
    xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="5.0">
    <context-param>
    <param-name>jakarta.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <context-param>
    <param-name>jakarta.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
    <param-value>true</param-value>
    </context-param>
    <context-param>
    <param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>saga</param-value>
    </context-param>
    <context-param>
    <param-name>org.apache.myfaces.AUTOMATIC_EXTENSIONLESS_MAPPING</param-name>
    <param-value>true</param-value>
    </context-param>
    </web-app>


    Below are my approaches which didn't worked:

    1. Added JBoss Dependency
    2. Converted @SessionScope annotation to @SessionScoped and added @ManagedBean
    3. Added Dependency Spring Tools Suite in Eclipse
    4. Downloaded latest Eclipse IDE for Enterprise Java and Web Developers
    5. Downloaded fresh Jakarta project from Jakarta EE starter, and imported it.
    6. Downloaded MyEclipse and imported my project.
    7. Changed xhtml tags to below:

    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="jakarta.faces.core"
    xmlns:jsf="jakarta.faces"
    xmlns:h="jakarta.faces.html"

    1. Downloaded IntelliJ IDE and imported my project (Auto completion was working some time)

    Approaches which worked:

    1. In NetBeans IDE it worked as expected. I was able to ctrl+click on java classes/methods and navigate to them, the code assist also worked. But I am used to Eclipse and I want to support this for my Jakarta project as well.
    2. Sometime cmd+. works for auto completion/code suggestion but they are not exact variable names.

    Let me know if you need more information. Thank you!

    Continue reading...

Compartilhe esta Página