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

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.

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

@sudhakar:

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

There's also a JIRA version

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

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 Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,096 views 0 5
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot