Skip to main content

Announcing the new Maven Schemaspy Plugin

Posted by johnsmart on August 13, 2008 at 4:29 PM PDT

Schemaspy is a little known but very useful database analysis tool that generates an interactive graphical representation of your database structure, in terms of tables and relationships. This is a very cool tool that works wonders when you need to understand a new database structure. Indeed Schemaspy gets a chapter in the Java Power Tools book. A sample Schemaspy report can be found here.

If you have a Maven project, this is a great thing to have in your Maven reports. Unfortunately, there is no official Maven plugin for Schemaspy (at least, not for Maven 2). So, to get around this, I wrote my own. This plugin lets you generate SchemaSpy reports from within your pom.xml file - they appear in the Maven reports just like ordinary Javadoc documentation.

For the moment, this plugin is deployed in the Wakaleo Maven repository, so you need to add a reference to this repository in your POM file or your settings.xml file, as shown here:

            <id>Wakaleo Repository</id>

The plugin is pretty easy to use: you just provide the details you would expect to access your database (JDBC URL, username, password,...). The full JDBC URL works fine. Or you can just provide the database name, type, and host address, which makes the configuration a bit lighter. The following listing illustrates how to use the plugin:


The plugin documentation can be found here. In particular, look at the usage page for more details on how to use the plugin.


I couldn't figure out how to run it as "mvn schemaspy:schemaspy". I get, "The plugin 'org.apache.maven.plugins:maven-schemaspy-plugin' does not exist". Running "mvn com.wakaleo.schemaspy:maven-schemaspy-plugin:1.0:schemaspy" does appear to work, though it sure is ugly. Is there a better way of doing this?