【问题标题】:Maven, save checksum files in target(build) directoryMaven,将校验和文件保存在目标(构建)目录中
【发布时间】:2016-02-22 07:06:03
【问题描述】:

我正在使用 maven-install-plugin 生成我的 .war 文件的校验和,但它们保存在我的本地 maven 存储库中。

<plugin>
    <artifactId>maven-install-plugin</artifactId>
    <version>2.3.1</version>
    <configuration>
      <createChecksum>true</createChecksum>
    </configuration>
  </plugin>

我需要什么:

1) 将校验和文件保存在我的目标构建目录中。

2) 将生成的校验和文件从目标构建目录复制到另一个位置(使用 maven-dependency-plugin ?)。

【问题讨论】:

    标签: maven checksum


    【解决方案1】:

    我正在做类似的事情 - 这是我目前的做法:

    为了生成校验和,我使用了 checksum-maven-plugin。 这是一个 pom.xml sn-p,它将在你的 target/ 目录中为它找到的所有 .war 文件生成 .sha1 校验和文件。 您可以调整 &lt;includes/&gt; 规范以更改哪些文件得到校验和,您可以调整 &lt;algorithms/&gt; 规范以指定使用哪些校验和算法。

      <plugin>
        <groupId>net.ju-n.maven.plugins</groupId>
        <artifactId>checksum-maven-plugin</artifactId>
        <version>1.3</version>
        <executions>
          <execution>
            <id>checksum-maven-plugin-files</id>
            <phase>package</phase>
            <goals>
              <goal>files</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <fileSets>
            <fileSet>
              <directory>${project.build.directory}</directory>
              <includes>
                <include>*.war</include>
              </includes>
            </fileSet>
          </fileSets>
          <algorithms>
            <algorithm>SHA-1</algorithm>
          </algorithms>
        </configuration>
      </plugin>
    

    可以通过多种方式将生成的校验和从目标目录复制到另一个位置,我想我需要更多关于您的使用情况的信息来推荐解决方案 - 您能否提供更多关于您计划如何使用的详细信息校验和文件以及它们在构建层次结构中的位置?

    参考资料:

    http://nicoulaj.github.io/checksum-maven-plugin/

    How do you create a checksum in Maven then output it to a text file?

    【讨论】:

      猜你喜欢
      • 2018-06-03
      • 2012-09-17
      • 2020-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-16
      • 1970-01-01
      相关资源
      最近更新 更多