schemacrawler / SchemaCrawler-Report-Maven-Plugin

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

Does the plugin support graphviz-java? #11

Closed allan-shoup closed 4 years ago

allan-shoup commented 4 years ago

Does the plugin support the graphviz-java option? If so, how should that be activated? I'm getting this when graphviz is not installed:

Aug 26, 2020 11:27:53 AM us.fatehi.utility.ProcessExecutor call
SEVERE: Cannot run program "dot": error=2, No such file or directory
java.io.IOException: Cannot run program "dot": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at us.fatehi.utility.ProcessExecutor.call(ProcessExecutor.java:77)
    at schemacrawler.tools.integration.diagram.GraphvizUtility.isGraphvizAvailable(GraphvizUtility.java:43)
    at schemacrawler.tools.integration.diagram.DiagramRenderer.checkAvailability(DiagramRenderer.java:73)
    at schemacrawler.tools.executable.BaseCommandChain.checkAvailabilityChain(BaseCommandChain.java:119)
    at schemacrawler.tools.executable.CommandDaisyChain.execute(CommandDaisyChain.java:114)
    at schemacrawler.tools.executable.SchemaCrawlerExecutable.execute(SchemaCrawlerExecutable.java:155)
    at schemacrawler.tools.integration.maven.SchemaCrawlerMojo.executeSchemaCrawler(SchemaCrawlerMojo.java:544)
    at schemacrawler.tools.integration.maven.SchemaCrawlerMojo.executeReport(SchemaCrawlerMojo.java:269)
    at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:251)
    at org.apache.maven.plugins.site.render.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:267)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:349)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale(SiteMojo.java:198)
    at org.apache.maven.plugins.site.render.SiteMojo.execute(SiteMojo.java:147)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    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:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
    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:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 35 more
sualeh commented 4 years ago

@allan-shoup - you should not need to do much. All you need to do is to add a dependency on graphviz-java to the plugin, similarly to the one shown below. Please let me know if that works for you, otherwise it may be a bug.

<plugin>
  <groupId>us.fatehi</groupId>
  <artifactId>schemacrawler-maven-plugin</artifactId>
  <version>16.9.4-2</version>
  <dependencies>
    <dependency>
      <groupId>guru.nidi</groupId>
      <artifactId>graphviz-java</artifactId>
      <version>0.17.0</version>
    </dependency> 
    <!-- IMPORTANT: Make sure you have a dependency on the JDBC driver.
      In this example, we are using HSQLDB as our database server. -->
    <dependency>
      <groupId>org.hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <version>2.5.1</version>
    </dependency>
  </dependencies>
</plugin>
allan-shoup commented 4 years ago

@sualeh, I tried adding the graphviz-java dependency and there was no change. Still getting the same error.

sualeh commented 4 years ago

@allan-shoup - thanks - I will try to reproduce it.

allan-shoup commented 4 years ago

@sualeh, any luck reproducing?

sualeh commented 4 years ago

@allan-shoup - no luck yet. I was able to reproduce. I rewrote the who Maven plugin, but I still cannot trace through what is going on.

allan-shoup commented 4 years ago

I'll volunteer to help debug if you thought it'd be helpful. If so, just point me to the new source.

sualeh commented 4 years ago

@allan-shoup - thanks. I have pushed the code already. I will release SchemaCrawler Maven plugin v16.10.1.1 shortly. This is a rewritten plugin, which basically calls the SchemaCrawler command-line. You should be able to use the technique above to add a dependency on graphviz-java. If you turn on logging, you will see the SchemaCrawler command-line the plugin generates. I could get SchemaCrawler to work with the Java plugin and that command-line, but not the Maven plugin, which is very strange.

sualeh commented 4 years ago

@allan-shoup - please try to debug with SchemaCrawler Report Maven Plugin v16.10.1.1. Thanks.

allan-shoup commented 4 years ago

I think the problem is that the generated output file path lacks the extension (which is automatically added by graphviz-java). Thus, when the code checks that the output file exists, it doesn't find it because the generated file has an extension.

allan-shoup commented 4 years ago

FYI, this may be premature, but it looks like the graphviz-java mode when running in the plugin is ignoring at least the schemacrawler.graph.graphviz_opts option from the configuration file.

sualeh commented 4 years ago

@allan-shoup - thanks! I will investigate and make a fix over the weekend. Or, if you have a fix, please submit a pull request. Please submit a new issue for Graphviz options - that will be a core SchemaCrawler issue, not a SchemaCrawler Report Maven Plugin issue.

sualeh commented 4 years ago

@allan-shoup - thanks for finding the issue! I have fixed it in v16.10.1.2

allan-shoup commented 4 years ago

Happy to help. I can confirm v16.10.1.2 fixes the problem.