使用SchemaCrawler Maven插件生成图形时的NPE

时间:2015-04-20 18:01:49

标签: java maven database-schema schemacrawler

我想使用SchemaCrawler生成数据库架构图,它是Maven插件。我不想使用像

这样的结构
java -classpath ../_schemacrawler/lib/*:lib/* ...

因为它必须是通用的。我想将Maven用于所有依赖项,用户只执行类似:

的操作
mvn schemacrawler:schemacrawler

甚至包装此命令的小bash脚本。

但是我在执行时遇到NullPointerException。我的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>

执行时

mvn schemacrawler:schemacrawler -e

我得到了:

  

[错误]无法执行目标   net.sourceforge.schemacrawler:schemacrawler - Maven的插件:9.5:schemacrawler   项目my-project上的(default-cli):执行default-cli of goal   net.sourceforge.schemacrawler:schemacrawler - Maven的插件:9.5:schemacrawler   失败。 NullPointerException - &gt; [帮助1]   org.apache.maven.lifecycle.LifecycleExecutionException:失败   执行目标   net.sourceforge.schemacrawler:schemacrawler - Maven的插件:9.5:schemacrawler   项目my-project上的(default-cli):执行default-cli of goal   net.sourceforge.schemacrawler:schemacrawler - Maven的插件:9.5:schemacrawler   失败。在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)     在   org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)     在   org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)     在   org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)     在   org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)     在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)at at   org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)at   org.apache.maven.cli.MavenCli.execute(mavenCli.java:537)at at   org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)at at   org.apache.maven.cli.MavenCli.main(MavenCli.java:141)at at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:497)at   org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)     在   org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)     在   org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)     在   org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)   引起:org.apache.maven.plugin.PluginExecutionException:执行   default-cli of goal   net.sourceforge.schemacrawler:schemacrawler - Maven的插件:9.5:schemacrawler   失败。在   org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)     ... 19更多引起:java.lang.NullPointerException at   java.io.File。(File.java:277)at   org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:89)     在   org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)     ......还有20个

请帮助我 - 怎么做?

1 个答案:

答案 0 :(得分:0)

请使用Exec Maven Plugin从Maven中执行SchemaCrawler,而不是SchemaCrawler插件。不幸的是,目前尚未维护SchemaCrawler Maven插件。

Sualeh Fatehi,SchemaCrawler