GKD
GKD

Reputation: 53

Javadoc creation with maven

We have created a new artifact to generate javadoc. We have 40 artifacts defined as dependencies. Task is to create javadoc.jar and html pages for the 40 dependency artifacts.

Whats the best approach to achieve this in maven?

Upvotes: 2

Views: 327

Answers (2)

Usman Ismail
Usman Ismail

Reputation: 18649

A slightly more automated approach than the answer above:

So to make this work you'll have to do all of this:

  • since this is a dedicated javadoc artifact, it won't have a main JAR artifact, so you'll probably want to set the packaging to POM
  • make sure all your referenced artifacts have attached sources
  • add <classifier>sources</classifier> to all your dependencies
  • unpack all dependencies to a common root folder using dependency:unpack-dependencies
  • Change your sources directory to where you unpacked all the dependencies
  • Use the source plugin to manage all the Javadoc generation and deployment

Upvotes: 1

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298818

This is very unusual. Javadoc works on sources, not compiled classes, whereas maven dependencies reference classes, not sources.

So to make this work you'll have to do all of this:

On re-reading the question: I'm assuming that you want to create combined docs of all dependencies. If not, you'll need 40 separate executions each of the javadoc, assembly and buildhelper plugins. Good luck with that.

Upvotes: 1

Related Questions