5

我喜欢从 maven 项目中的 .puml 文件生成图像。

我不喜欢归档的是项目和生成图像的库之间的硬绑定。所以我喜欢使用这个构建命令:

mvn com.github.jeluard:plantuml-maven-plugin:1.2:generate \
  -Dplantuml.outputDirectory=target \
  -Dplantuml.sourceFiles={*.puml}

所以第三行填充了sourceFiles-class-variable

不幸的是,语法{*.puml}似乎是错误的:

[INFO] --- plantuml-maven-plugin:1.2:generate (default-cli) @ test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.047 s
[INFO] Finished at: 2018-02-16T14:50:09+01:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.jeluard:plantuml-maven-plugin:1.2:generate 
        (default-cli) on project test: Unable to parse configuration of mojo 
        com.github.jeluard:plantuml-maven-plugin:1.2:generate for parameter sourceFiles: 
        Cannot find default setter in class org.apache.maven.model.FileSet -> [Help 1]
4

1 回答 1

-1

最好通过 pom.xml 指定源文件集,并通过 -f 指定该文件:mvn -f mypom.xml。

请参阅jeluard/maven-plantuml-plugin 用法

<build>
  <plugins>
    <plugin>
      <groupId>com.github.jeluard</groupId>
      <artifactId>plantuml-maven-plugin</artifactId>
      <version>1.2</version>
      <configuration>
        <sourceFiles>
          <directory>${basedir}</directory>               <=======
          <includes>
            <include>src/main/plantuml/**/*.txt</include> <=======
          </includes>
        </sourceFiles>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>net.sourceforge.plantuml</groupId>
          <artifactId>plantuml</artifactId>
          <version>7999</version>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>
</build>
于 2018-02-20T17:19:20.673 回答