Search code examples
mavennetbeansautocompletejsp-tagsopencms

How to enable jsp-tags autocompletion in NetBeans within NetBeans Maven projects?


Using NetBeans 7.1.2.

When editing pages with NetBeans as per the procedure explained below, the IDE offers only autocompletion for <jsp:...> tags:

enter image description here

This is how I have created the NetBeans project and the jsp (though it isn't archetype specific, nor the issue has anything to do with opencms): I have created a maven project with the OpenCms-Module archetype

mvn archetype:generate -DarchetypeCatalog=http://bp-cms-commons.sourceforge.net/m2repo

The archetype creates a maven project with jar packaging.

After that, I have added a jsp under src/main/opencms/modules/blahblah/templates.

And then I have added the taglibs.standard dependency to the project, to try to provide NetBeans with the corresponding tlds.


Solution

  • After several hours trying to get this working, I found this reported and closed bug that hinted me into the right direction:

    1. Added src/main/webapp directory Edit 1: There is autocompletion only for jstl tags if the files are inside src/main/webapp. Workaround in linux (not sure if windows links will work): Create a symlink:

      • ln -s opencms/ src/main/webapp from the project root folder
    2. Change maven project packaging to war (Project properties -> General -> Packaging) (Notice that neither the @taglib directive nor the taglibs.standard dependency are necessary.)

      If the Web Pages entry does not appear under your project (in the projects view), you may need to restart NetBeans. Now you'll have full autocompletion (only) under src/main/webapp! :-)

    Autocompletion fixed

    Edit 2

    Unfortunately, if under version control, NetBeans sees the symlink as a new directory, and all files under it, as new files :-( This is very inconvenient, because to access the IDE integrated version control functionality, you still need to open the original resource.