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

。_饼干妹妹 提交于 2020-01-02 06:18:14

问题


Still learning how to use Maven, and I was wondering if there is a way to do a checksum on the generated WAR file.

The Maven goal is package, and what I'm trying to achieve is to get a checksum value (of the packaged WAR file) put into a text file alongside the packaged file.

Thanks in advance!


回答1:


Got it working with the below pom code and changing my Maven goal to verify

<dependency>
    ...
    <!-- CheckSum -->
    <dependency>
      <groupId>net.ju-n.maven.plugins</groupId>
      <artifactId>checksum-maven-plugin</artifactId>
      <version>1.2</version>
      <exclusions>
          <exclusion>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
          </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcprov-jdk15on</artifactId>
        <version>1.51</version>
    </dependency>
</dependencies>

<plugins>
    ...
    <plugin>
        <groupId>net.ju-n.maven.plugins</groupId>
        <artifactId>checksum-maven-plugin</artifactId>
        <version>1.2</version>
        <executions>
            <execution>
                <goals>
                  <goal>artifacts</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <fileSets>
                <fileSet>
                    <includes>
                      <include>**/*.war</include>
                    </includes>
                </fileSet>
            </fileSets>
            <csvSummary>true</csvSummary>
            <csvSummaryFile>IRIDDS-checksums.csv</csvSummaryFile>
        </configuration>
        <dependencies>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>1.51</version>
            </dependency>
        </dependencies>
    </plugin>
</plugins>


来源:https://stackoverflow.com/questions/25368728/how-do-you-create-a-checksum-in-maven-then-output-it-to-a-text-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!