Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Eclipse Code Completion not working in JSP

Avatar

Former Community Member

Hi everyone,

I have successfully configured my CQ project using maven and eclipse and can import,  I have followed the steps here : http://dev.day.com/docs/en/cq/5-3/developing/developmenttools/developing_with_eclipse.html

As the document suggests I add all the jar files to my build path but the code completion id not working in my JSP.

For example in my JSP I have

resourceResolver.getResource("/content...");

however when I hit control space I do not see any methods on the resourceResolver object.

Does anyone work this way and be able to give me some tips?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Getting code completion working in Eclipse was a major hurdle for our existing codebase - took quite a bit of fiddling with maven artifacts and their versions, but we ended up getting it working for both Juno and Kepler. Two things that are important:

  1. you need to add the right artifacts not only to your core pom.xml, but also the ui/app pom.xml.
  2. even after getting the dependencies right, eclipse was pretty buggy for us - sometimes JSP code completion stops working and requires a restart, and when we initiate code completion, we have to wait for the popup box to get populated before typing a partial match, otherwise JSTL tags don't show up.
  3. when editing a JSP, make sure you're opening it through the ui/app project and not the parent project.
  4. consider switching to IntelliJ, it handles multi-module maven projects a lot better than eclipse, it can auto-complete EL statements - and has a bunch of other advantages as well :)

View solution in original post

1 Reply

Avatar

Correct answer by
Former Community Member

Getting code completion working in Eclipse was a major hurdle for our existing codebase - took quite a bit of fiddling with maven artifacts and their versions, but we ended up getting it working for both Juno and Kepler. Two things that are important:

  1. you need to add the right artifacts not only to your core pom.xml, but also the ui/app pom.xml.
  2. even after getting the dependencies right, eclipse was pretty buggy for us - sometimes JSP code completion stops working and requires a restart, and when we initiate code completion, we have to wait for the popup box to get populated before typing a partial match, otherwise JSTL tags don't show up.
  3. when editing a JSP, make sure you're opening it through the ui/app project and not the parent project.
  4. consider switching to IntelliJ, it handles multi-module maven projects a lot better than eclipse, it can auto-complete EL statements - and has a bunch of other advantages as well :)
The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----