Custom/Stock Plugin Modules Not Recognized - JSDoc 3

264 views
Skip to first unread message

Kristian

unread,
Mar 28, 2012, 2:13:14 PM3/28/12
to JSDoc Users
Hello,

Following the instructions in the README file, I created my own plugin
module to define custom tags for JSDoc 3:

plugins/customTags.js:

<code>
exports.defineTags = function(dictionary) {
dictionary.defineTag('glslUniform', {
mustHaveValue: false,
isNamespace: false,
onTagged: function(doclet, tag) {
doclet.kind = "glslUniform";
}
}
};
</code>

I then included my plugin in conf.json:
<code>
{
"tags": {
"allowUnknownTags": true
},
"source": {
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/)_"
},
"plugins": [
"plugins/customTags"
],
"jsVersion": 180
}
</code>

When I then run jsdoc, I get the following error:

js: "jsdoc.js", line 86: exception from uncaught JavaScript throw:
Error: Module "plugins/customTags" not found.

I thought maybe I had done something wrong in the creation of my
plugin file, so I tried using the stock "shout" plugin, but received
the same exception. My working directory is the root jsdoc folder
(jsdoc runs fine when I don't try to use any plugins). Any ideas as
to what I might be doing wrong?

Thanks,

Kristian

Michael Mathews

unread,
Mar 28, 2012, 4:37:25 PM3/28/12
to Kristian, JSDoc Users
Sorry, no, I can't say exactly what went wrong. I tried the shout plugin and it worked exactly as expected.

I then tried your plugin, and noticed the syntax error, which I fixed, and then it also ran without exception.

From the error message you quoted it sounds like there is a problem with the path to the plugins directory itself. Here's how I ran my test with your plugin:

$ cd ~/projects/jsdoc
$ ./jsdoc test/cases/classtag.js

Using the "./jsdoc" shell script should set up the correct path variables for you. If you're trying something much different than that, then that may be the problem.

Michael Mathews
mic...@gmail.com

> --
> You received this message because you are subscribed to the Google Groups "JSDoc Users" group.
> To post to this group, send email to jsdoc...@googlegroups.com.
> To unsubscribe from this group, send email to jsdoc-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jsdoc-users?hl=en.
>

Kristian

unread,
Mar 28, 2012, 5:41:33 PM3/28/12
to JSDoc Users
Interesting. I just downloaded and extracted a fresh copy of JSDoc 3
and tried to run the shout plugin and received the same error. Also,
what was the syntax error you found (not that it would help running
the shout example)?

On Mar 28, 4:37 pm, Michael Mathews <micm...@gmail.com> wrote:
> Sorry, no, I can't say exactly what went wrong. I tried the shout plugin and it worked exactly as expected.
>
> I then tried your plugin, and noticed the syntax error, which I fixed, and then it also ran without exception.
>
> From the error message you quoted it sounds like there is a problem with the path to the plugins directory itself. Here's how I ran my test with your plugin:
>
> $ cd ~/projects/jsdoc
> $ ./jsdoc test/cases/classtag.js
>
> Using the "./jsdoc" shell script should set up the correct path variables for you. If you're trying something much different than that, then that may be the problem.
>
> Michael Mathews
> micm...@gmail.com

Michael

unread,
Mar 28, 2012, 7:13:26 PM3/28/12
to Kristian, JSDoc Users
From the code cited in your email, there is a missing closing parenthesis.

What is the exact command lines you are using (see how I quoted mine exactly)? What OS, Java Version, etc?

Have any other users ever had any similar issues?

Kristian

unread,
Mar 29, 2012, 10:08:35 AM3/29/12
to JSDoc Users


On Mar 28, 7:13 pm, Michael <micm...@gmail.com> wrote:>
> What is the exact command lines you are using (see how I quoted mine exactly)? What OS, Java Version, etc?

I am running Windows 7 Enterprise and Java 7 Update using the
following command line:

C:\[...]\jsdoc3-jsdoc-dfd5955>java -classpath lib/js.jar
org.mozilla.javascript.tools.shell.Main -modules node_modules -modules
rhino_modules jsdoc.js -c conf.json -r -d out test/cases/classtag.js

js: "jsdoc.js", line 86: exception from uncaught JavaScript throw:
Error: Module
"plugins/shout" not found.

conf.json:

{
"tags": {
"allowUnknownTags": true
},
"source": {
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/)_"
},
"plugins": ["plugins/shout"],
"jsVersion": 180
}

Michael Mathews

unread,
Mar 29, 2012, 11:41:50 AM3/29/12
to Kristian, JSDoc Users
Hi Kristian,

The only currently supported way of running jsdoc 3 is via the shell script, which you are going to have to duplicate in a Windows-way if you want to use it on your OS. Ensure that your current working directory, as understood by the Java process, is the directory containing the plugins folder. It might make a difference which way your slashes are leaning as well. As I don't use Windows, I can't really say for certain what the specific issue is.

}

Kristian

unread,
Mar 29, 2012, 12:00:19 PM3/29/12
to JSDoc Users
Ah, thank you. I'll try running it through Cygwin.

On Mar 29, 11:41 am, Michael Mathews <micm...@gmail.com> wrote:
> Hi Kristian,
>
> The only currently supported way of running jsdoc 3 is via the shell
> script, which you are going to have to duplicate in a Windows-way if you
> want to use it on your OS. Ensure that your current working directory, as
> understood by the Java process, is the directory containing the plugins
> folder. It might make a difference which way your slashes are leaning as
> well. As I don't use Windows, I can't really say for certain what the
> specific issue is.
>

Kristian

unread,
Mar 30, 2012, 2:58:40 PM3/30/12
to JSDoc Users
The following problem is not directly related to jsdoc, but maybe
someone here will be familiar with the issue:

After installing Cygwin, whenever I run the shell script (e.g. ./jsdoc
-T), I receive the error:

$ ./jsdoc -T
java.lang.NoClassDefFoundError: org/mozilla/javascript/tools/shell/
Main
Caused by: java.lang.ClassNotFoundException:
org.mozilla.javascript.tools.shell.Main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class:
org.mozilla.javascript.tools.shell.Main. Program will exit.
Exception in thread "main"

Kristian

unread,
Mar 30, 2012, 5:42:45 PM3/30/12
to JSDoc Users
Nevermind my previous post - I've gotten plugins to work on Windows
without the use of Cygwin. I used the following command line:

java -classpath lib/js.jar org.mozilla.javascript.tools.shell.Main -
modules node_modules -modules rhino_modules -modules . jsdoc.js -c
conf.json -r -d out myFile.js

The '-modules .' was previously missing. You may want to update the
sample command in the README on the github page to include this
missing bit, as that's what I originally followed. It was only by
comparing my command line to the shell script that I was able to spot
the difference.

Thanks,

Kristian

Michael

unread,
Mar 30, 2012, 6:44:58 PM3/30/12
to Kristian, JSDoc Users
Hi Kristian,

That's very useful information, and I definitely will update the user guide with your command line. Thanks so much for feeding back.

--
m

Reply all
Reply to author
Forward
0 new messages