Lately I was going through one of the Netbeans Platform tutorials, and then I came to the part where you have to edit layer.xml file in your module's project. But I had no idea what layer.xml is. Moreover author have not told to check "Generate XML Layer", so there was no such file in my project. I've spent some time to figure out what it should look like and how to add it, so I'll try to give you my acknowledgement about this stuff.
1) What is layer.xml?
As you can read on Netbeans Wiki (DevFaqModulesLayerFile)
Layer files are small XML files provided by modules, which define a virtual filesystem. The layer file defines folders and files that will be merged into the system filesystem that makes up the runtime configuration information NetBeans and its modules use.
Layer files help to make it possible for modules to be dynamically installed. If you've read about FileObjects and FileSystems, you know that you can listen for changes in folders and files in a filesystem. That's exactly what the components of NetBeans whose content is composed from folders in the system filesystem do. So if a module is added at runtime, the system filesystem fires changes; the UI notices that the contents of the folder has changed and updates the UI to reflect the changes.
This file is quite handy while designing a module, but what to do if you haven't created layer.xml during a module creation?
2) Where to find layer.xml?
You don't want to write all the file yourself for sure. Especially when it can be found 100% correct with a full description of your module.
After you build a module, you can find generated-layer.xml in build/classes/META-INF/generated-layer.xml
And it has all you need.
3) How to add layer.xml to existing module?
First of all you need to put the file itself into the project. The default location is near the Bundle.properties file and other classes in your default package of the project: Project/Source Packages/defaultpackage/layer.xml
Then you need to tell about it in manifest file Project/Important Files/Module Manifest. Mine looks like this:
Manifest-Version: 1.0
OpenIDE-Module: org.shop.uiOpenIDE-Module-Localizing-Bundle: org/shop/ui/Bundle.propertiesOpenIDE-Module-Layer: org/shop/ui/layer.xmlOpenIDE-Module-Requires: org.openide.windows.WindowManagerOpenIDE-Module-Specification-Version: 1.0So you have to put down where the OpenIDE-Module-Layer is. If you have put it in the same directory with Bundle.properties then the difference will be only in the last node of the path (file name).

