Ben Ripkens

back to blog index

Exclude files from automatic JavaScript documentation generation

In December I wrote an article about the JsDoc toolkit and especially about a Maven plug-in that simplifies the build process. A few days ago the author of this plug-in, i.e. Martin Reurings, contacted me and asked for some feedback. We discussed the issues that I mentioned in my previous article and that the plug-in is missing some exclude / include functionality. Recently he implemented this functionality and released version 2.3.2.

Now to use this plug-in add the plug-in repository

<pluginRepositories>
    <pluginRepository>
        <id>jsdoctk2</id>
        <url>http://jsdoctk-plugin.googlecode.com/svn/repo</url>
    </pluginRepository>
</pluginRepositories>

and add the following to the report plug-in section to your pom.

<plugin>
    <groupId>nl.windgazer</groupId>
    <artifactId>jsdoctk-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <recurse>3</recurse>
        <exclude>
            <param>/^(?!diagram-).+/</param>
            <param>common.js</param>
            <param>jquery-1.4.4.min.js</param>
            <param>jquery-ui-1.8.6.custom.min.js</param>
            <param>vtip-min.js</param>
        </exclude>
    </configuration>
</plugin>

Now I tried to exclude all files using a negative look ahead /^(?!diagram-).+/. This regex means “Ignore everything that does not start with diagram-” (all the JavaScript files for the visualization in my last project have the common prefix diagram-) but unfortunately it’s not working. Maybe I used a wrong syntax for the exclusion but I can’t seem to find more documentation about it. If you know what went wrong or how to realize it without mentioning every JavaScript file that should be excluded please let me know. Anyway this feature may allow more projects to use the plug-in and is generally a great addition to the plug-in.

That's me, Ben.
Hey, I am Ben Ripkens (bripkens) and this is my blog. I live in Düsseldorf (Germany) and I am employed by the codecentric AG as a Software Engineer. Web application frontends are my main area of expertise, but you may also find some other interesting articles on this blog.