文件经过网络传输等原因对源项目包造成损坏时方便排查,一般做法是在maven工程打包时自动自动生成MD5和SHA-1校验文件。具体做法是在maven的pom文件里的build->plugins->添加 如下代码:
<!-- 生成MD5校验文件 -->
<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>*.jar</include>
</includes>
</fileSet>
</fileSets>
<algorithms>
<algorithm>SHA-1</algorithm>
<algorithm>MD5</algorithm>
</algorithms>
</configuration>
</plugin>