1
votes

I want to generate DB schema graph using SchemaCrawler and it's Maven plugin. I don't want to use constructions like

java -classpath ../_schemacrawler/lib/*:lib/* ...

because it must be universal. I want to use Maven for all dependencies and users will only execute something like:

mvn schemacrawler:schemacrawler

or even a small bash script wrapping this command.

But I'm getting NullPointerException when executing. Part of my pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>net.sourceforge.schemacrawler</groupId>
            <artifactId>schemacrawler-maven-plugin</artifactId>
            <version>9.5</version>
            <configuration>
                <driver>com.mysql.jdbc.Driver</driver>
                <url>jdbc:mysql://localhost:3306/my-db</url>
                <user>root</user>
                <password>qwerty</password>
                <infolevel>maximum</infolevel>
                <command>details</command>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.35</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

When executing

mvn schemacrawler:schemacrawler -e

I'm getting:

[ERROR] Failed to execute goal net.sourceforge.schemacrawler:schemacrawler-maven-plugin:9.5:schemacrawler (default-cli) on project my-project: Execution default-cli of goal net.sourceforge.schemacrawler:schemacrawler-maven-plugin:9.5:schemacrawler failed. NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.sourceforge.schemacrawler:schemacrawler-maven-plugin:9.5:schemacrawler (default-cli) on project my-project: Execution default-cli of goal net.sourceforge.schemacrawler:schemacrawler-maven-plugin:9.5:schemacrawler failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal net.sourceforge.schemacrawler:schemacrawler-maven-plugin:9.5:schemacrawler failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.lang.NullPointerException at java.io.File.(File.java:277) at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:89) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) ... 20 more

Please help me - how it can be done?

1

1 Answers

0
votes

Please use the Exec Maven Plugin to execute SchemaCrawler from within Maven, instead of the SchemaCrawler plugin. Unfortunately, the SchemaCrawler Maven plugin is not being maintained at this time.

Sualeh Fatehi, SchemaCrawler