Report del database di un progetto Maven

Per documentare la struttura del database utilizzato in un progetto Maven si utilizza il reporting plugin per Schemaspy.

SchemaSpy is a Java-based tool (requires Java 5 or higher) that analyzes the metadata of a schema in a database and generates a visual representation of it [...]

Tutto quello che dovrebbe servire è reperibile a questo indirizzo:
maven.wakaleo.com
Il plugin per SchemaSpy è ospitato nella repository Wakaleo.
Per utilizzarla, è necessario aggiungere il suo indirizzo nella sezione del file pom.xml del progetto.

    <pluginRepositories>
    ...
        <pluginRepository>
            <id>Wakaleo Repository</id>
            <url>http://maven.wakaleo.com/repos/</url>
        </pluginRepository>
        ...
    </pluginRepositories>

Per creare il report SchemaSpy all'interno del sito del progetto, basta includere il plugin nella sezione del pom:

<project>
    ...
    <reporting>
        <plugins>
            <plugin>
                <groupId>com.wakaleo.schemaspy</groupId>
                <artifactId>maven-schemaspy-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <databaseType>mysql</databaseType>
                    <database>testdb</database>
                    <host>localhost</host>
                    <user>the.user</user>
                    <password>the.password</password>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
    ...
</project>

Il plugin accetta tutti i parametri standard di SchemaSpy.

Most databases with JDBC drivers available in the standard Maven repository should work out-of-the-box. Currently, these are: * Derby * MySQL * HSQLDB * PostgreSQL * MS SQLServer using the JTDS driver
(mssql-jtds) Others, such as DB2, Oracle, MS SQL Server (if using the Microsoft driver) and Firebird, don't have drivers in the repositories.
In this case, or if you want to specify a different driver, you need to specify the driver manually using the parameter:

<project>
    ...
    <reporting>
        <plugins>
            <plugin>
                <groupId>com.wakaleo.schemaspy</groupId>
                <artifactId>maven-schemaspy-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <databaseType>mysql</databaseType>
                    <database>testdb</database>
                    <host>localhost</host>
                    <user>the.user</user>
                    <password>the.password</password>
                    <outputDirectory>target/site/schemaSpy-full</outputDirectory>
                    <pathToDrivers>src/test/resources/lib/derby-10.1.2.1.jar</pathToDrivers>
                    <commentsInitiallyDisplayed>true</commentsInitiallyDisplayed>
                    <noTableComments>true</noTableComments>
                    <noImplied>true</noImplied>
                    <allowHtmlInComments>true</allowHtmlInComments>
                    <cssStylesheet>testSchemaSpy.css</cssStylesheet>
                    <schemaDescription>Maven Plugin SchemaSpy? Test</schemaDescription>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
    ...
</project>