When you develop a NetBeans module using the Maven-approach, every time you “Clean & build” your module the userdir, which is placed in the target-directory by default, will be deleted. “Clean & Build” is necessary if you’re altering the layer.xml directly or indirectly by using annotations like @ActionReferences. So after that you have to reconfigure your target platform again, f.e. by opening the same projects and files to restore the previous state. That is annoying, but easy to fix.
Add a profile to your settings.xml
<profile> <id>userdir</id> <properties> <netbeans.userdir>../userdir</netbeans.userdir> </properties> </profile>
After that you can choose the profile from the profile-dropdown or in the context-menu of the project node.
This way the configured userdir is used for running/debugging your NetBeans module. It won’t get deleted automatically.
Advanced tips: Of course you can also configure an absolute path or even make the profile default by applying activeByDefault
<profile> <id>userdir</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <netbeans.userdir>/home/user/myuserdir</netbeans.userdir> </properties> </profile>