I am currently working on a Java project in GitHub and I need on every update to manually generate JavaDoc and upload it on GitHub Page. But it's very tedious.
And I wondering if is possible to automatise this with a CI?
Yes is possible, with this code on your GitHub Actions :
name: Deploy Javadoc
on:
push:
branches:
- master
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Deploy JavaDoc 🚀
uses: MathieuSoysal/Javadoc-publisher.yml@v2.0.4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
javadoc-branch: javadoc
java-version: 17
target-folder: javadoc
Credit: https://github.com/MathieuSoysal/Javadoc-publisher.yml https://github.com/marketplace/actions/deploy-javadoc
This code publishes JavaDoc automatically when you publish your code to "master" branch, your JavaDoc is pushed on javadoc branch, and deployed with GitHub Page.
don't forget to enable GitHub page on your GitHub repo settings
To create a GitHub Actions you need to simply add this yaml file on /.github/workflows/<your-file>.yaml
inside your GitHub repository.
Sorry, I may have missed the focus of the question …
But for my understanding, a CI process chain generates artefacts automatically from source files provided to it, usually by a repository.
The process chain triggers all kinds of programs to generate these artefacts, like compilers, linkers, and other stuff.
So where is the problem to invoke the javadoc
tool as part of the CI chain?
Both Gradle and Maven have plugins for JavaDoc, and even ant has commands to start JavaDoc.
Even for the alternative Doxygen tool do exist means to integrate that into Gradle and Maven …
And at worst case, how big a difficulty is it to launch the javadoc
tool from a batch file?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.