Search code examples
javamavendocumentation-generationmaven-archetype

Document a maven archetype with the project layout and usage


When I generate the site documentation using the site plugin, all I see in the About page is the description of the archetype that I've specified in the <description> element of the archetype's POM.

How do I get to see something like the generated project's layout and the archetype usage like this? Do I only have to do that manually?


Solution

  • The Maven Site plugin looks under src/site for documentation. By default it expects the documentation to be written using the Doxia Markup language. The project structure you reference is written using this markup. You can find it in the source code of src/site/apt/index.apt in the Maven archetypes project.

    The markup for the project structure you mention is defined there:

    34  +----+
    35  
    36  project
    37  |-- pom.xml
    38  `-- src
    39      `-- site
    40          |-- apt
    41          |   |-- format.apt
    42          |   `-- index.apt
    43          |-- fml
    44          |   `-- faq.fml
    45          |-- fr
    46          |   |-- apt
    47          |   |   |-- format.apt
    48          |   |   `-- index.apt
    49          |   |-- fml
    50          |   |   `-- faq.fml
    51          |   `-- xdoc
    52          |       `-- xdoc.xml
    53          |-- xdoc
    54          |   `-- xdoc.xml
    55          |-- site_fr.xml
    56          `-- site.xml
    57  
    58  +----+
    

    It should be fairly obvious looking at that, how to write the markup for your own such structure. If you wish to auto-generate such a structure, then I suspect that you may need to write a simple Maven plugin to iterate through your project directories. I'm not aware of any preexisting plugins, but I wouldn't be surprised to find one out there.