PHPDoc 文档生成器在 Eclipse 中还是在 Eclipse 之外?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1184627/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHPDoc documentation generator in or out of Eclipse?
提问by AlexA
I am developing with Eclipse + PDT. I've been adding phpdoc comments into my code, but actually never generated a resulting documentation in Eclipse. How should I do it - is there some functionality in Eclipse, or doc generation should be done externally?
我正在使用 Eclipse + PDT 进行开发。我一直在我的代码中添加 phpdoc 注释,但实际上从未在 Eclipse 中生成结果文档。我应该怎么做 - Eclipse 中是否有一些功能,或者文档生成应该在外部完成?
采纳答案by Pascal MARTIN
To generate the documentation, you should use phpDocumentor, which can be installed as a PEAR package.
要生成文档,您应该使用phpDocumentor,它可以作为 PEAR 包安装。
Then, you have to call it from command-line ; I've never seen it called from Eclipse PDT, actually.
然后,您必须从命令行调用它;实际上,我从未见过它从 Eclipse PDT 调用。
A great solution is to have a continuous-integration platform (using phpUnderControl, for instance), and integrate to creation of the phpdoc in your build configuration file ; this way, the phpdoc is generated everytime someone commits (or once a day, or whenever you want ^^ ).
一个很好的解决方案是拥有一个持续集成平台(例如,使用phpUnderControl),并将其集成到构建配置文件中的 phpdoc 的创建中;这样,每次有人提交(或每天一次,或每当您想要 ^^ 时)都会生成 phpdoc 。
In Eclipse PDT, you can call "external tools" (see "Run > External Tools" in the menu) ; this would allow you to launch the phpdoc command (like you do from CLI) ; but it definitly is not as user-friendly as what Zend Studio offers -- not the same price either, though ^^
在Eclipse PDT中,您可以调用“外部工具”(参见菜单中的“运行>外部工具”);这将允许您启动 phpdoc 命令(就像您在 CLI 中所做的那样);但它绝对不像 Zend Studio 提供的那样用户友好——虽然价格也不一样^^
回答by Davide Pastore
回答by Rich Seller
Yes there is a wizard to do this in Zend. Check out this brief guide.
是的,Zend 中有一个向导可以执行此操作。查看此简要指南。
Alternatively you can create an external launch configuration to invoke the standard phpDocumentor.
或者,您可以创建一个外部启动配置来调用标准phpDocumentor。
- Select Run->External Tools->External Tools Configurations...
- In the left hand pane, select Program then the new icon (left-most icon above the pane).
- In the right hand pane, select the Main tab.
- Enter generate_doc in the Name: field.
- Enter the path to the phpdoc cli tool in the Location: field.
- Enter any required arguments in the Arguments field, e.g. for the current project input ${project_loc}.
- To run the external configuration, select Run.
- 选择运行->外部工具->外部工具配置...
- 在左侧窗格中,选择程序,然后选择新图标(窗格上方最左侧的图标)。
- 在右侧窗格中,选择 Main 选项卡。
- 在名称:字段中输入 generate_doc。
- 在位置:字段中输入 phpdoc cli 工具的路径。
- 在参数字段中输入任何必需的参数,例如用于当前项目输入 ${project_loc}。
- 要运行外部配置,请选择运行。
To rerun the configuration you have a few choices:
要重新运行配置,您有几个选择:
- Select the External Tools icon from the menu bar external tools icon http://help.eclipse.org/ganymede/topic/org.eclipse.cdt.doc.user/images/icon%5Fext%5Ftools.png"then click generate_doc
- Select Run->External Tools->generate_doc
- Hit Alt+R, E, 1 (assuming generate_doc is the first item in the list, otherwise pick the appropriate number)
- 从菜单栏中选择外部工具图标外部工具图标 http://help.eclipse.org/ganymede/topic/org.eclipse.cdt.doc.user/images/icon%5Fext%5Ftools.png"然后点击 generate_doc
- 选择运行->外部工具->generate_doc
- 按 Alt+R, E, 1 (假设 generate_doc 是列表中的第一项,否则选择适当的数字)