Disclaimer: Any of these cannot be currently added/changed from the IDE's UI. These extension points are only accessible to developers willing to provide additional functionality.
Custom Maven Project templates
You can add your site specific maven project template with predefined values. It can contain the project.xml POM file, the properties files, custom maven.xml and other files and directories you want to make part of the default setup.
- First you will need to create a new maven project for the extension you want to provide. You will need to create a dependency on the current version of mevenide-netbeans-project module. Please check the http://mevenide.codehaus.org/mevenide-netbeans-project site or the IDE's Tools/Option dialog for current version you have installed. (version 0.4 should be ok).
- create a custom manifest file:
Manifest-Version: 1.0 OpenIDE-Module-Layer: org/myorganization/myextension/MavenLayer.xml
where the org/myorganization/myextension string is the package declarion of your project, and the MavenLayer.xml file is included in the resources of the project and will be included in the jar.
- assign maven.nbm.manifest property with the location of the manifest file, so that the definiton is included in the jar when building the module.
- write the MavenLayer.xml file. Example code looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd"> <filesystem> <folder name="Templates"> <folder name="Project"> <folder name="Maven"> <file name="mytemplatename.zip" url="mytemplatename.zip"> <attr name="template" boolvalue="true"/> <attr name="instantiatingIterator" newvalue="org.mevenide.netbeans.project.wizards.MavenNewWizardIterator"/> <attr name="SystemFileSystem.localizingBundle" stringvalue="path.to.the.file.Bundle"/> <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/org/mevenide/netbeans/project/resources/MavenIcon.gif"/> <attr name="instantiatingWizardURL" urlvalue="nbresloc:/path/to/the/file/emptyProject.html"/> </file> </folder> </folder> </folder> </filesystem>
- SystemFileSystem.localizingBundle attribute of the mytemplatename.zip file in the definition point to a Bundle.properties file that has to be included in the jar at the defined package. It shall include the localizable name for your Maven project template. The property key is the path within the layer file, eg.
Templates/Project/Maven/mytemplatename.zip=My custom Maven Project
- By specifying the SystemFileSystem.icon attribute, you can provide your own icon for the template.
- instantiatingWizardURL attribute point to a HTML file describing your template in more detail. Please stick to simple HTML.
- SystemFileSystem.localizingBundle attribute of the mytemplatename.zip file in the definition point to a Bundle.properties file that has to be included in the jar at the defined package. It shall include the localizable name for your Maven project template. The property key is the path within the layer file, eg.
- The mytemplatename.zip file contains all the files and directories that you want to be included in the project. At least it should contain project.xml file. Place it in your module at the same directory/package as the MavenLayer.xml file.
- Once you created all the files and placed them in the right positions in the artifact, it should be enough to create an NBM file for your project and install it in the IDE. The custom project template should be available to the user in the New project dialog.
Additional information about defined maven plugin's properties.
By default mevenide tries to guess the properties of a maven plugin by consulting the plugin cache and the plugin.properties file there. However not all properties have an entry in the plugin.properties file. In order to get a complete list and also to provide additional information about the properties, one can create a module that improves the behaviour for the plugin.
- Steps are similar to the previous case. Create a netbeans module with manifest and layer file.
- The layer file points to a xml file that describes the plugin's properties.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd"> <filesystem> <folder name="Plugins"> <folder name="Maven"> <folder name="PluginProperties"> <file name="mycustom-plugin-1.5.xml" url="resources/mycustom-plugin.xml"/> </folder> </folder> </folder> </filesystem>
where mycustom-plugin.xml file is located relatively to package of the layer file. The expected filename pattern on the system filesystem is <plugin-name>-<version>.xml. That way one can specify definitions for multiple versions of one plugin.
- The mycustom-plugin-1.5.xml file can look like this:
<plugin-provider id="mycustom-plugin" name="My Custom Plugin"> <description>Description of my plugin</description> <category name="All"> <property name="maven.jar.excludes" label="Jar Excludes" default="**/package.html" required="false" description="Specifies a list of patterns to exclude from the jar process. The default value is **/package.html, and is used by the java:jar goal."/> <property name="maven.jar.includes" label="Jar Includes" default=" " required="false" description=" Specifies a list of patterns to include with the jar process. The default value is null"/> </category> </plugin-provider>
Custom jelly taglibrary code completion
- First you will need to create a new maven project for the extension you want to provide. You will need to create a dependency on the current version of mevenide-netbeans-grammar module. Please check the http://mevenide.codehaus.org/mevenide-netbeans-grammar site or the IDE's Tools/Option dialog for current version you have installed.
- create a custom manifest file:
Manifest-Version: 1.0 OpenIDE-Module-Layer: org/myorganization/myextension/MavenLayer.xml
where the org/myorganization/myextension string is the package declarion of your project, and the MavenLayer.xml file is included in the resources of the project and will be included in the jar.
- assign maven.nbm.manifest property with the location of the manifest file, so that the definiton is included in the jar when building the module.
- write the MavenLayer.xml file. Example code looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd"> <filesystem> <folder name="Plugins"> <folder name="XML"> <folder name="Mevenide-Grammar"> <file name="jelly-antlr.xml" url="nbresloc:/org/myorganization/myextension/taglibs/jelly-antlr.xml"/> </folder> </folder> </filesystem>
where you replace the jelly-antlr string with the name of your taglib. Under this name it will be later known to the completion engine. You can have multiple taglib definitions into the layer, just write multiple <file> elements.
- include also the taglib definition xml file. The syntax is quite simple and self-describing as the example shows.
<?xml version="1.0" encoding="UTF-8"?> <!-- code completion definition for the jelly-tag library --> <taglib name="jelly:define"> <tag name="taglib"> <attr name="uri"/> <attr name="inherit"/> <attr name="trim"/> </tag> <tag name="tag" within="taglib"> <attr name="name"/> <attr name="trim"/> </tag> <tag name="bean" within="taglib"> <attr name="classLoader"/> <attr name="className"/> <attr name="name"/> <attr name="varAttribute"/> <attr name="trim"/> </tag> </taglib>
The attribute within lets you define scope of the particular tag. In this example tag and bean tags will only appear within the taglib tag.
- Once you created all the files, it should be enough to create an NBM file for your project and install it in the IDE. The custom taglib completion info should be available to the user.
