Friday Jan 08, 2010

JavaHelp in a Mavenized NetBeans Platform Application

I successfully created JavaHelp for my Mars Rover Viewer on Maven:

  1. In the pom.xml of the container (i.e., the highest level pom.xml file):
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>nbm-maven-plugin</artifactId>
        <version>3.0</version>
        <extensions>true</extensions>
        <dependencies>
            <dependency>
                <groupId>javax.help</groupId>
                <artifactId>javahelp</artifactId>
                <version>2.0.02</version>
            </dependency>
        </dependencies>
        <configuration>
            <descriptor>src/main/nbm/module.xml</descriptor>
            <brandingToken>${brandingToken}</brandingToken>
            <cluster>foobar</cluster>
        </configuration>
    </plugin>

    A comment from Milos Kleint: "You need to make sure the project is using 3.0 nbm-plugin (as done above), the setup with 3.1 plugin is broken currently. 3.1 is using netbeans 6.7 ant tasks. Someone put some classes in the com.sun.javahelp package there in the ant tasks jar. Which seems to work with the nb.org javahelp jar, but fails with the javahelp jar in the maven repository. The maven repo jar is signed unfortunately and the few additional classes in the same package, but different jar messes up the classloading permissions and the signing fails. which is a pity as 3.1 didn't need the plugin dependency addition, so was simpler to configure.. a workaround I found was to un-sign the javahelp jar in the local maven repo, but that's nasty."

  2. In the manifest of the module where the help content is found:
    OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help

  3. Create an Ant-based NetBeans module and use the JavaHelp wizard. Then copy the created "JavaHelp" module to your Maven module's "src/main/javahelp".

  4. Layer.xml entry:
    <folder name="Services">
        <folder name="JavaHelp">
            <file name="module1-helpset.xml" url="module1-helpset.xml">
                <attr name="position" intvalue="3818"/>
            </file>
        </folder>
    </folder>

I needed to remove the "search" tags in the "-hs" file, otherwise a "search is invalid" error was thrown when the Help menu item was selected. That should result in other problems but at least the help content is shown and you can search it anyway.

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« January 2010 »
SunMonTueWedThuFriSat
     
2
4
9
10
16
20
22
      
Today