Reputation: 8670
I am generating the Javadoc of my project using maven (with the javadoc:javadoc
goal).
I have also configured the Javadoc Location property of my project to the folder where maven generates the Javadoc. Then I can easily see the full Javadoc of a class from the Eclipse Javadoc view by selecting "Open Attached Javadoc in a Browser".
However, every time I do some changes in the documentation I need to explicitly recreate the documentation with maven, before I can see the documentation updates in the browser.
Is there a way I can instruct Eclipse to automatically generate the Javadoc files when a file is saved ?
I know this is probably not a good idea when not focused on writing documentation, since it may slow down a bit Eclipse. However, when my main task is writing documentation, a bit of automation in this sense will be appreciated. I guess the right solution passes by updating the documentation of only the files that were saved (and not triggering the whole Javadoc generation process), but I do not know if such a thing is possible.
Upvotes: 0
Views: 704
Reputation: 9138
If you're using the Maven Integration for Eclipse (m2e), you can set up a plugin execution filter so that m2e knows that you desire a particular plugin execution to be also executed in Eclipse. You would want to have the plugin run in the background:
<execute >
<runOnIncremental>true</runOnIncremental>
</execute >
The flip side of this all is that it will run your entire Javadoc execution whenever you save something, incremental is misleading in that sense. It may clog up your Eclipse, and not just "a bit", like you say in the updated question. Every plugin execution that does more than the absolute trivial should be heavily scrutinized.
A truly incremental solution will not come from Maven, since it has no sense of only parts of the project having to be built. Rather, you would need Eclipse to do this directly. I think the same thing happens for Java compilation: it is done by Eclipse itself, incrementally. However, according to the Javadoc FAQ:
A9. Can I incrementally build a document from different runs of Javadoc?
Basically no (...)
We call this incremental build and are considering it for a future release.
But nothing is impossible :)
Upvotes: 1