使用Plantuml Maven插件生成UML图时出错

时间:2018-08-13 12:49:35

标签: maven-plugin plantuml

我正在使用植物uml maven插件生成UML图。

  <groupId>com.github.jeluard</groupId>
  <artifactId>plantuml-maven-plugin</artifactId>

但是在生成类图时出现以下错误:

[ERROR] Failed to execute goal com.github.jeluard:plantuml-maven-plugin:1.1:generate (create-docs) on project my-app-docs: Exception during plantuml
process: input == null! -> [Help 1]


java.lang.NullPointerException
        at net.sourceforge.plantuml.svek.image.EntityImageClass.<init>(EntityImageClass.java:79)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2.createEntityImageBlock(CucaDiagramFileMakerSvek2.java:368)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2.printEntityInternal(CucaDiagramFileMakerSvek2.java:339)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2.printEntity(CucaDiagramFileMakerSvek2.java:320)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2.printEntities(CucaDiagramFileMakerSvek2.java:312)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek2.createFile(CucaDiagramFileMakerSvek2.java:146)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFileInternal(CucaDiagramFileMakerSvek.java:132)
        at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFile(CucaDiagramFileMakerSvek.java:105)
        at net.sourceforge.plantuml.cucadiagram.CucaDiagram.exportDiagramInternal(CucaDiagram.java:316)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagram(UmlDiagram.java:224)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagramsCuca(PSystemUtils.java:202)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:65)
        at net.sourceforge.plantuml.SourceFileReader.getGeneratedImages(SourceFileReader.java:130)
        at com.github.plantuml.maven.PlantUMLMojo.execute(PlantUMLMojo.java:202)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
        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: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:956)
        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)

更新:-

导致问题的

PlantUML代码是

@startuml
title Class Diagram
hide empty methods

class Account {
   accountId
}
@enduml

Maven插件配置

         <plugin>
            <groupId>com.github.jeluard</groupId>
            <artifactId>plantuml-maven-plugin</artifactId>
            <version>1.1</version>
            <configuration>
               <sourceFiles>
                  <directory>${basedir}/models</directory>
                  <includes>
                     <include>*.puml</include>
                  </includes>
               </sourceFiles>
               <outputDirectory>${basedir}/models/png</outputDirectory>
            </configuration>
            <dependencies>
               <dependency>
                  <groupId>net.sourceforge.plantuml</groupId>
                  <artifactId>plantuml</artifactId>
                  <version>7999</version>
               </dependency>
            </dependencies>
            <executions>
               <execution>
                  <id>create-docs</id>
                  <phase>install</phase>
                  <goals>
                     <goal>generate</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>

Maven版本3.3.9
Java:1.8

1 个答案:

答案 0 :(得分:0)

我已经通过更新plantuml工件的版本解决了这个问题:)

com.github.jeluard:plantuml-maven-plugin,版本为1.2
net.sourceforge.plantuml:plantuml,版本为8059