If you work with Eclipse and JSF 2, you too may be annoyed at the little warning-icon.png that shows up next to all yourfaces-config.xml files (even those that are blessedly empty).

Here is how you can get rid of them, and add autocompletion to faces-config editing as well, in case they aren't empty after all. (Most of mine contain a single element, to specify a resource bundle. Eliminating that would be a nice item for convention-over-configuration in JSF 2.1).

  1. Download the source code for JSF 2 from http://javaserverfaces.dev.java.net
  2. Make a directory such as ~/xsd and copy all files with extension .xsd frommojarra-version-sources/jsf-api/doc into that directory (so you can remove the source later)
  3. In Eclipse, locate a faces-config.xml and copy the entryhttp://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsdfrom the xsi:schemaLocation attribute. You'll need it in the clipboard for step 5.
  4. Select WindowPreferencesXMLXML Catalog

    http://weblogs.java.net/blog/cayhorstmann/archive/eclipse-xml-1.png

  5. Select Add and fill in the dialog as shown below. Pick the .xsd file by clicking on File System and navigating to the directory in which you saved the files. Change the Key Type to Schema Location. Paste in the key. 

    http://weblogs.java.net/blog/cayhorstmann/archive/eclipse-xml-2.png

  6. Rebuild your project. The warning-icon.png should be gone.

This also works for other XML schemas (such as the one for facelet tag library descriptors).