chonton / exists-maven-plugin

Check if artifact exists in remote maven repository
Apache License 2.0
47 stars 18 forks source link

useChecksum fail if there is no remote artifact #7

Closed Nowheresly closed 6 years ago

Nowheresly commented 6 years ago

I'm trying to use this plugin to avoid a BUILD FAILED in case maven tries to upload an already existing artifact in our repository with the same checksum. We want a BUILD FAILED only when checksum are different while version is the same.

To achieve that, here's my configuration:

            <plugin>
                <groupId>org.honton.chas</groupId>
                <artifactId>exists-maven-plugin</artifactId>
                <version>0.0.5</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>remote</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <failIfNotExists>false</failIfNotExists>
                    <useChecksum>true</useChecksum>
                </configuration>
            </plugin>

Unfortunately, the plugin fails if no remote artifact is available:

Caused by: org.apache.maven.plugin.MojoExecutionException: Fetching remote checksum failed for https://our-repo/repository/releases/
    at org.honton.chas.exists.RemoteExistsMojo$WagonHelper.get (RemoteExistsMojo.java:185)
    at org.honton.chas.exists.RemoteExistsMojo.getRemoteChecksum (RemoteExistsMojo.java:111)
    at org.honton.chas.exists.AbstractExistsMojo.verifyWithChecksum (AbstractExistsMojo.java:145)
    at org.honton.chas.exists.AbstractExistsMojo.execute (AbstractExistsMojo.java:101)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    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:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at 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)

I would have expected the plugin to set maven.skip.deploy=false instead of interrupting the build.

Am I missing something ?