【问题标题】:Use standalone executable JAR as a plugin for site maven goal使用独立的可执行 JAR 作为站点 Maven 目标的插件
【发布时间】:2017-09-05 06:55:16
【问题描述】:

我有一个可执行的 JAR-with-dependencies 文件,它对测试报告进行一些操作。

我将它保存在我的项目中,并希望它在 Maven 'site' 目标完成后立即执行。 有没有合适的方法来做到这一点? 也许通过在此处某处添加该文件的路径?

 <reporting>
        <excludeDefaults>true</excludeDefaults>
        <plugins>

            <plugin>
                <groupId>my JAR file</groupId>
                <artifactId>traceability-matrix-builder</artifactId>
                <path> path to the file</path>
            </plugin>
        </plugins>
    </reporting>

提前致谢!

【问题讨论】:

    标签: maven jar pom.xml


    【解决方案1】:

    解决了。很简单:

    1. 添加exec插件并指定可执行jar的路径:

          <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <version>1.3.2</version>
              <configuration>
                  <executable>java</executable>
                  <arguments>
                      <argument>-jar</argument>
                      <argument>traceability-matrix-builder-1.0-SNAPSHOT-jar-with-dependencies.jar</argument>
                  </arguments>
              </configuration>
          </plugin>
      
    2. 在站点后添加目标:

      mvn 站点 exec:exec

    就是这样!

    【讨论】:

      猜你喜欢
      • 2017-07-06
      • 1970-01-01
      • 2012-06-13
      • 1970-01-01
      • 2011-05-22
      • 2014-06-24
      • 2021-10-04
      • 2017-01-29
      • 1970-01-01
      相关资源
      最近更新 更多