schemacrawler / SchemaCrawler-Report-Maven-Plugin

Generate SchemaCrawler reports for Maven generated project websites
Eclipse Public License 2.0
8 stars 6 forks source link

Execution default-cli of goal schemacrawler:schemacrawler failed. NullPointerException #2

Closed joe776 closed 6 years ago

joe776 commented 7 years ago

I'm pretty lost why the exception occurs. Also I'm confused on how I have to use and configure the plugin, as both parts shown in the "Goal" and "Usage" sections of the documentation seem to be incomplete (Goal does not show any configuration, Usage does not show the reporting part described in Goal). Furthermore I have to add the configuration directly when also declaring the dependencies to the JDBC driver, otherwise SchemaCrawler complains about the configuration being missing. One complete example of a POM would be very helpful.

This is the full exception stacktrace:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal us.fatehi:schemacrawler-maven-plugin:14.16.03:schemacrawler (default-cli) on project user-backend-schema: Execution default-cli of goal us.fatehi:schemacrawler-maven-plugin:14.16.03:schemacrawler failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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:498)
    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 us.fatehi:schemacrawler-maven-plugin:14.16.03:schemacrawler failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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:498)
    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: java.lang.NullPointerException
    at java.io.File.<init> (File.java:277)
    at org.apache.maven.reporting.AbstractMavenReport.execute (AbstractMavenReport.java:89)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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:498)
    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)

The relevant parts of the POM look like this:

  <properties>
    <version.schemacrawler>14.16.03</version.schemacrawler>
    <jdbc.driver>org.h2.Driver</jdbc.driver>
    <jdbc.url>jdbc:h2:file:./target/user-backend</jdbc.url>
    <jdbc.user>test</jdbc.user>
    <jdbc.pass>test</jdbc.pass>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>us.fatehi</groupId>
        <artifactId>schemacrawler-maven-plugin</artifactId>
        <version>${version.schemacrawler}</version>
        <dependencies>
          <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <driver>${jdbc.driver}</driver>
          <url>${jdbc.url}</url>
          <user>${jdbc.user}</user>
          <password>${jdbc.pass}</password>
          <infolevel>maximum</infolevel>
          <command>details</command>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.4</version>
        <configuration>
          <reportPlugins>
            <plugin>
              <artifactId>maven-project-info-reports-plugin</artifactId>
              <version>2.4</version>
              <reportSets>
                <reportSet>
                  <reports>
                    <report>dependencies</report>
                    <report>license</report>
                  </reports>
                </reportSet>
              </reportSets>
            </plugin>
            <!-- DEFINE SchemaCrawler REPORT GENERATION HERE -->
            <plugin>
              <groupId>us.fatehi</groupId>
              <artifactId>schemacrawler-maven-plugin</artifactId>
              <version>${version.schemacrawler}</version>
              <configuration>
                <driver>${jdbc.driver}</driver>
                <url>${jdbc.url}</url>
                <user>${jdbc.user}</user>
                <password>${jdbc.pass}</password>
                <infolevel>maximum</infolevel>
                <command>details</command>
              </configuration>
            </plugin>
          </reportPlugins>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>us.fatehi</groupId>
        <artifactId>schemacrawler-maven-plugin</artifactId>
        <version>${version.schemacrawler}</version>
      </plugin>
    </plugins>
  </reporting>
DanielFran commented 6 years ago

@joe776 did you found a way to use this plugin?

joe776 commented 6 years ago

Unfortunately not. We ended up writing a small shell script which is run during the Maven build.

DanielFran commented 6 years ago

Can you share it? Thanks

joe776 commented 6 years ago

Basically the one already provided with SchemaCrawler, with some custom adjustments: https://github.com/schemacrawler/SchemaCrawler/blob/master/schemacrawler-distrib/src/assembly/schemacrawler.sh Then just call it with the maven-exec-plugin.

sualeh commented 6 years ago

Please take a look at the example code in schemacrawler/SchemaCrawler-Report-Maven-Plugin-Usage-Example