如何在 Maven 中为 war 文件生成校验和

how to generate a checksum for a war file in maven

我继承了一个使用 maven pom 文件构建 .war 文件的项目,我们有一个生成 .war 文件校验和的请求,所以我的问题是,这可以在 maven pom 文件中完成吗?需要什么插件以及如何配置?

我们使用 maven-war-plugin 构建

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
           <version>2.5</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>target/minifiedOutput</directory>
                    </resource>
                </webResources>
            </configuration>
        </plugin>

是否可以使用 maven-install-plugin 生成输出 war 文件的校验和,搜索主题似乎提供校验和功能,但我不清楚如何将它与现有的 pom 文件集成?

使用Maven 安装插件:https://maven.apache.org/plugins/maven-install-plugin/plugin-info.html ,将配置中的属性设置为:createChecksum 为true。这是一种常见的做法。

还有其他插件: http://nicoulaj.github.io/checksum-maven-plugin/