Generate javadoc and publish on confluence

We use Atlassian on demand stack which include bamboo and Confluence. I am looking for help and suggetions on how I can generate the JavaDoc for our java projects and publish on Conflence.

One of the way I know is generate the javadoc as part of mvn build and attach that as artifacts with every build but that's not the convinent way of using it since user would need to access different url every time and second is they need to dowload this html files locally on their box to see the API help which is definately not the convininent way so could you please suggest some better way of publishing javadocs.

5 answers

1 accepted

This widget could not be displayed.

For our generated documentation, we have a plan that is executed nightly. All it does is use a script to generate the docs in one job, and then use a seperate script to copy them to an internal web server in another job, overwriting the previous version. Then developers always look in the same spot on the web server for up-to-date documentation.

It's a bit low-tech, but it works perfectly well, and I personally don't see any value in putting generated documentation into Confluence.

In your case, you could add a new stage to your build plan the generates the javadoc using mvn (if that hasn't been done already), and then either copy them to a web server or run a simple web server on your buld box.

This widget could not be displayed.

Use the Docs Plugin (https://marketplace.atlassian.com/plugins/net.meixxi.confluence.docs.docs-plugin). This plugin also provides an REST interface for automated publishing using Bamboo or any other CI System. You can find the technical documentation here: https://bitbucket.org/meixxi/docs-plugin/wiki/REST_Interface

This widget could not be displayed.

@sudhakar:

See this plugin ... Doxygen (Javadoc) in Atlassian Confluence 

There's also a JIRA version

This widget could not be displayed.

Thanks Gary..it's quite helpfull. Since I did not got any other answer so I am assuming that it's not possible to publish this on Confluence.

No worries - glad I could help

This widget could not be displayed.

Oh there is a lot of ways to achieve it and they depends on what you want to achieve.

Lets start from simple one.

1. Enable HTML macro in confluence (if your instance is public, please watch for it). Alternatively you can use plugin pack from Adaptavist (search google). They have iframe macro available.

2. Store your java doc somewhere on intranet. Add iframe to your page.

Drawbacks is that it will not be searchable or browsable from confluence menu. users will have to go to page and traverse from there.

More advanced way and it would require you do to do some scripting work:
1.Lets say we will use Java Doc space

2. Generate your java doc into html files.

3. Remove Old Java Doc space, Create new one.

4. Use Confluence CLI to import your javadoc html files into confluence.

I am not sure if point 3 is needed, no idea if CLI can add new versions of the files if needed. Still you would need to detect removed pages. I woudl still remove old file, i don't need history - can get it from versioning system

Last the most advance version is

1. Write your own plugin :)

Simple version is the best if you want something quick and dirty, but basically this is gary's version packed into iframe and shown into yoru confluence (just for conevience so devs does not have to look through intranet). Second version is for nice solution with search and everything, but require you to do some scripting.

Re points 1 and 2. iFrames with relative embedded links don't work well within Confluence. They _display_ ok, but after the pages are in Confluence, the relative links start looking for the wiki's host url and Confluence tries to resolve them using its own path, eg, mycompany.com/wiki/display/some+other+page

otoh, Generating the html and then importing it into Confluence as individual pages seems like it might work, but it would need to be automated with a script.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

115 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you