This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257684

Summary: JSF 2 composite components in JAR are not recognized
Product: javaee Reporter: ban.nobuhiro
Component: JSF EditorAssignee: Martin Fousek <marfous>
Status: NEW ---    
Severity: normal CC: asbachb, greensoft
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:

Description ban.nobuhiro 2016-01-23 03:29:59 UTC

NetBeans 8.1 does not recognize JSF composite components in JAR files.
Component files are stored in JAR as /META-INF/resources/**/*.xhtml.


In org.netbeans.modules.web.jsf.editor.index.CompositeComponentModel
( ),
getResourcesDirectory(FileObject) checks path:
>  if (folder.getName().equalsIgnoreCase("resources")) { //NOI18N
>      //check if its parent is META-INF
>      FileObject parent = folder.getParent();
>      if (parent != null && parent.getNameExt().startsWith("META-INF")) { //NOI18N
>          //the folder seems to be the right resources folder
>          return folder;
>      }
>  }

but this is buggy, so
  * /META-INF/resources/ : not match
  * /foo.META-INF/resources/ : match
  * /foo.META-INFbar/resources/ : match

Suggested fix:

  parent.getName().equalsIgnoreCase("META-INF") .
Comment 1 ban.nobuhiro 2016-03-20 07:22:56 UTC
>Suggested fix:
>  parent.getNameExt().startsWith("META-INF")
>  parent.getName().equalsIgnoreCase("META-INF") .

This fix was not enough...

org.netbeans.modules.web.jsf.editor.index.JsfBinaryIndexer does not
search *.xhtml files:
>namePattern = ".*\\.tld|.*\\.taglib\\.xml",
>indexVersion = JsfBinaryIndexer.INDEXER_VERSION,
>indexerName = JsfBinaryIndexer.INDEXER_NAME)

So you need to add "*.xhtml" to namePattern in Registration.
(And need to increment indexVersion ?)
Comment 2 greensoft 2016-11-21 11:38:32 UTC
Despite the low number of votes so far, this (hopefully easily fixed) issue is very important for the continued popularity of NetBeans for JSF work. 

Combined with the lack of a dedicated NetBeans Web Fragment Project that one can easily reference as a Project dependency (the workaround for which is to use a Web Application project and use a custom Ant task to build a JAR with appropriate structure, which then can't be "seen" because of this issue here, this issue renders NetBeans barely usable for modular JSF work.

I have spent the last few days reading nearly everything possible about strategies for modularising Java EE projects. Again and again in forum postings I've encountered people who are (or were) using NetBeans with Ant but have been forced to move eventually to Eclipse (+ Maven) because of these two related issues:

1. Lack of a dedicated Web Fragment Project that builds a JAR (see workaround here

2. Even if you build a composite component library JAR with the correct structure, the NetBeans JSF/XHTML editor can't "see" the composite components.

I have used both Eclipse and NetBeans for many years professionally. For standalone JSF Web Application development I prefer NetBeans; for highly modularised JSF development (with intermediate JSF "library" layer separated from EJB and EIS/database layers and client web app) it is currently almost unusable.

A quick tour of Stackoverflow reveals that you are losing otherwise avid NetBeans fans to Eclipse because of these related issues.
Comment 3 greensoft 2016-12-01 07:37:25 UTC
Have also tried using NetBeans Maven projects and the same problem exists. Please see description of Maven setup here:
Comment 4 appercel 2016-12-01 10:05:23 UTC
I have to agree that I also have to workaround this limitation when using NetBeans, and I'm then forced to design, implement, or declare my JSF components in a way that I would not otherwise do if this limitation did not exist.

I've tried other IDE's because of that, namely IntelliJ and Eclipse, but still I prefer NetBeans though.