nicoulaj/checksum-maven-plugin

Fails with error, No file to process, when used in POM-only projects

ansell opened this issue · 0 comments

I attempted to use this on a POM-only project (a parent POM) to enable it to always be used in children without having to configure or include it directly in each child project each time, but it failed with the following traces:

[INFO] --- checksum-maven-plugin:1.5:artifacts (generate-artifact-checksums) @ parentpom ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=36, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=18, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1, ConflictResolver.conflictItemCount=36, DefaultDependencyCollector.collectTime=19, DefaultDependencyCollector.transformTime=1}
[DEBUG] net.nicoulaj.maven.plugins:checksum-maven-plugin:jar:1.5:
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.2.1:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.2.1:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.2.1:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.2.1:compile
[DEBUG]       org.apache.maven:maven-model:jar:2.2.1:compile
[DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.2.1:compile
[DEBUG]          org.apache.maven:maven-repository-metadata:jar:2.2.1:compile
[DEBUG]          backport-util-concurrent:backport-util-concurrent:jar:3.1:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.2.1:compile
[DEBUG]       org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
[DEBUG]       org.apache.maven:maven-artifact:jar:2.2.1:compile
[DEBUG]       org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG]          junit:junit:jar:4.12:compile
[DEBUG]             org.hamcrest:hamcrest-core:jar:1.3:compile
[DEBUG]          classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
[DEBUG]    org.bouncycastle:bcprov-jdk15on:jar:1.55:compile
[DEBUG] Created new class realm plugin>net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5
[DEBUG] Importing foreign packages into class realm plugin>net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5
[DEBUG]   Included: net.nicoulaj.maven.plugins:checksum-maven-plugin:jar:1.5
[DEBUG]   Included: backport-util-concurrent:backport-util-concurrent:jar:3.1
[DEBUG]   Included: org.codehaus.plexus:plexus-interpolation:jar:1.11
[DEBUG]   Included: junit:junit:jar:4.12
[DEBUG]   Included: org.hamcrest:hamcrest-core:jar:1.3
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0.24
[DEBUG]   Included: org.bouncycastle:bcprov-jdk15on:jar:1.55
[DEBUG] Configuring mojo net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5:artifacts from plugin realm ClassRealm[plugin>net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@ba8a1dc]
[DEBUG] Configuring mojo 'net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5:artifacts' with basic configurator -->
[DEBUG]   (f) algorithms = [MD5, SHA-1, SHA-256, SHA-512]
[DEBUG]   (f) appendFilename = false
[DEBUG]   (f) attachChecksums = false
[DEBUG]   (f) csvSummary = false
[DEBUG]   (f) csvSummaryFile = artifacts-checksums.csv
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) failOnError = true
[DEBUG]   (f) includeRelativePath = false
[DEBUG]   (f) individualFiles = true
[DEBUG]   (f) project = MavenProject: com.github.ansell:parentpom:2-SNAPSHOT @ /home/mint/gitrepos/ansell-parentpom/pom.xml
[DEBUG]   (f) quiet = false
[DEBUG]   (f) shasumSummary = false
[DEBUG]   (f) shasumSummaryFile = artifacts-checksums.sha
[DEBUG]   (f) xmlSummary = false
[DEBUG]   (f) xmlSummaryFile = artifacts-checksums.xml
[DEBUG] -- end configuration --
[ERROR] No file to process.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.183 s
[INFO] Finished at: 2017-06-27T10:21:45+10:00
[INFO] Final Memory: 14M/47M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5:artifacts (generate-artifact-checksums) on project parentpom: No file to process. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.nicoulaj.maven.plugins:checksum-maven-plugin:1.5:artifacts (generate-artifact-checksums) on project parentpom: No file to process.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: No file to process.
	at net.nicoulaj.maven.plugins.checksum.mojo.AbstractChecksumMojo.execute(AbstractChecksumMojo.java:193)
	at net.nicoulaj.maven.plugins.checksum.mojo.ArtifactsMojo.execute(ArtifactsMojo.java:33)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 20 more

The relevant part of the POM is:

        <build>
                <pluginManagement>
                        <plugins>
                                <plugin>
                                        <groupId>net.nicoulaj.maven.plugins</groupId>
                                        <artifactId>checksum-maven-plugin</artifactId>
                                        <version>1.5</version>
                                        <executions>
                                                <execution>
                                                        <id>generate-artifact-checksums</id>
                                                        <goals>
                                                                <goal>artifacts</goal>
                                                        </goals>
                                                </execution>
                                        </executions>
                                        <configuration>
                                                <algorithms>
                                                        <algorithm>MD5</algorithm>
                                                        <algorithm>SHA-1</algorithm>
                                                        <algorithm>SHA-256</algorithm>
                                                        <algorithm>SHA-512</algorithm>
                                                </algorithms>
                                        </configuration>
                                </plugin>
                        </plugins>
                </pluginManagement>
                <plugins>
                        <plugin>
                                <groupId>net.nicoulaj.maven.plugins</groupId>
                                <artifactId>checksum-maven-plugin</artifactId>
                        </plugin>
                </plugins>
        </build>

From looking through the source code, it appears it is intentional that the POM is excluded, but there doesn't seem to be a configuration variable for either switching on support for it (maven-install-plugin generates checksums for POM files, but only MD5 and SHA1), or ignoring the error:

https://github.com/nicoulaj/checksum-maven-plugin/blob/master/src/main/java/net/nicoulaj/maven/plugins/checksum/mojo/ArtifactsMojo.java#L172