java 使用 GitHub、Sonatype Maven 存储库提供 JavaDocs
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3939595/
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
Making JavaDocs available with GitHub, Sonatype Maven repo
提问by StaxMan
Although Github provides a nice home for Java open source projects, there are some things that are still missing compared to more mature open source hosting places. I have so far figured out that Sonatype offers Maven repository access for open source projects, which solves one issue; and there are many solutions for user/dev mailing lists.
尽管 Github 为 Java 开源项目提供了一个不错的家园,但与更成熟的开源托管场所相比,仍然缺少一些东西。到目前为止,我已经发现 Sonatype 为开源项目提供了 Maven 存储库访问,这解决了一个问题;并且有许多针对用户/开发邮件列表的解决方案。
But one thing I am now trying to resolve is that of publishing automatically generated javadocs for online browsing. Although publishing source jars via Maven helps a bit with IDEs, I still like ability to browse javadocs online without downloading or importing a project. Does anyone know of a good way to achieve this, for projects hosted at Github? (need not be something Github offers, but ideally something that can be automated to happen when release is cut)
但我现在要解决的一件事是发布自动生成的 javadoc 以供在线浏览。尽管通过 Maven 发布源 jar 对 IDE 有一点帮助,但我仍然喜欢无需下载或导入项目即可在线浏览 javadoc 的能力。对于在 Github 上托管的项目,有没有人知道实现这一目标的好方法?(不需要 Github 提供的东西,但理想情况下可以在发布被切断时自动发生的东西)
回答by Jake Wharton
GitHub serves static HTML files that are in the gh-pages
branch of your repo at http://your_username.github.com/your_repo/
. In theory, Maven could be made to do the following:
GitHub 提供位于gh-pages
.repo 分支中的静态 HTML 文件http://your_username.github.com/your_repo/
。理论上,Maven 可以执行以下操作:
- Commit the release
pom.xml
. - Generate the JavaDocs to a
.gitignore
'd directory (so it would be preserved across branch changes). - Checkout the
gh-pages
branch. - Replace all of the files in the working directory with that of the directory the JavaDocs were copied to
- Commit
- Checkout the original branch.
- Continue with release...
- 提交发布
pom.xml
。 - 将 JavaDocs 生成到
.gitignore
'd 目录(因此它将在分支更改中保留)。 - 结帐
gh-pages
分行。 - 将工作目录中的所有文件替换为 JavaDoc 复制到的目录中的文件
- 犯罪
- 签出原始分支。
- 继续发布...
I'm only two days in to using Maven for a few of my projects so this is way beyond my capabilities. I'd be eager to see this implemented either with existing plugins or a custom plugin.
我只有两天时间在我的一些项目中使用 Maven,所以这超出了我的能力。我很想看到使用现有插件或自定义插件实现这一点。
回答by Gewthen
There is now a Maven plugin that can push a directory to a particular branch on githib at: http://github.com/github/maven-plugins.
现在有一个 Maven 插件可以将目录推送到 githib 上的特定分支:http://github.com/github/maven-plugins 。
回答by John Kristian
You can use a shell script to do the git checkout/add/commit/checkout/push as Jake Wharton suggested, and configure Ant or Gradle to run the shell script after it generates the javadoc. I'm not sure this would work with Maven. Here's an example shell script.
您可以按照 Jake Wharton 的建议使用 shell 脚本执行 git checkout/add/commit/checkout/push,并配置 Ant 或 Gradle 在生成 javadoc 后运行 shell 脚本。我不确定这是否适用于 Maven。这是一个示例 shell 脚本。
回答by Samuel Santos
You can use the github pages, creating a static web site then you put your javadoc in a directory and commmit to gh-pages branch.
您可以使用 github 页面,创建一个静态网站,然后将您的 javadoc 放在一个目录中并提交到 gh-pages 分支。
see the Git hub pages, its simple and useful.
查看 Git 中心页面,它简单而有用。
see
看
http://readwrite.com/2013/11/27/github-pages-explained#awesm=~oII5EQELsqV6S7
http://readwrite.com/2013/11/27/github-pages-explained#awesm=~oII5EQELsqV6S7