nicoulaj / checksum-maven-plugin

Compute Maven project artifacts/dependencies/files checksum digests.
https://checksum-maven-plugin.nicoulaj.net
Apache License 2.0
43 stars 40 forks source link

When providing multiple algorithms, checksum:artifacts fails when using summary #46

Open patrickfav opened 7 years ago

patrickfav commented 7 years ago

When I add multiple algorithms in the pom plugin config the build fails with:

Failed to execute goal net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5:artifacts (default-cli) on project uber-apk-signer: Must use only one type of hash

when using:

mvn clean install checksum:artifacts

My config is:

            <plugin>
                <groupId>net.nicoulaj.maven.plugins</groupId>
                <artifactId>checksum-maven-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>artifacts</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <algorithms>
                        <algorithm>SHA-256</algorithm>
                        <algorithm>SHA-1</algorithm>
                    </algorithms>
                    <shasumSummary>true</shasumSummary>
                    <shasumSummaryFile>checksum.txt</shasumSummaryFile>
                    <attachChecksums>false</attachChecksums>
                    <quiet>false</quiet>
                </configuration>
            </plugin>

It seems when not using summary, this works.

Full project: https://github.com/patrickfav/uber-apk-signer

btw. the doc lacks correct closing tags with <algorithm>...</algorithm> here https://checksum-maven-plugin.nicoulaj.net/artifacts-mojo.html#algorithms

bondolo commented 7 years ago

The intention of the summary file is to produce a file compatible with the *nix shasum file format. This file format does not support multiple algorithms so unfortunately neither can the checksum plugin. Your solution is to use multiple executions each with a single algorithm and a different ouput file.

patrickfav commented 7 years ago

Hi bondolo, Thanks for the quick reply. How about generating multiple summary files then? Otherwise the algorithm config is kind of confusing.

bondolo commented 7 years ago

That is a possibility but you could do what we do which is to have multiple executions, one for each desired hash type. The per-execution configuration is just the algorithm and filename.