simpligility / maven-repository-tools

Tools for interacting with Maven repositories
Eclipse Public License 1.0
137 stars 66 forks source link

Success reported even if repository provisioner is unable to retrieve artifact #50

Open TimothyScales opened 4 years ago

TimothyScales commented 4 years ago

If the repository provisioner is unable to retrieve the requested artifact from the source repo, it incorrectly returns a success exit code. In MavenRepositoryProvisioner.java the reportResults() method first checks for a retrieval failure and correctly sets the value of "provisioningSuccess". It then checks for a deployment failure; if nothing was retrieved, deployment never executes, and as a result never fails, so no deployment failure is reported. At this point, the value of "provisioningSuccess" is overwritten by the "success" code from the (non-)deployment, which causes the utility to return 0 (Success) despite its failure to read from the source repository (it does log the failed retrieval to the console, however). This is a problem when using the repository provisioner to automatically copy several files between repos inside an unattended app which needs to respond appropriately to a failure.

mosabua commented 4 years ago

You could supply a patch that allows it to fail in a more explicit way. This will be tricky since there are always lots of artifacts missing in source repos (like pom files or source or javadoc files and so on).