Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Get Maven to Fail on Deploy when warned about "CHECKSUM FAILED"

On maven deploy maven attempts to retrieve the previous metadata form the repository. If it is corrupt maven issues a warning, calls the build successful but doesn't upload my artifact. This was caused by corruption in my repository and I'd like to either avoid it in future or make it more obvious with a build failure.

Can I alter my pom to change this warning into an error so I'll see it quickly?

[INFO] Retrieving previous metadata from daeng-snap [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ea12f35b3bc6d88f7336891562d91985b412bf1a'; remote = '51a6f4a52ad8f3926dbb28807317a90b9cd62ec1' - RETRYING [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ea12f35b3bc6d88f7336891562d91985b412bf1a'; remote = '51a6f4a52ad8f3926dbb28807317a90b9cd62ec1' - IGNORING [INFO] Uploading repository metadata for: 'artifact com.myco.xyz' [INFO] Uploading project information for xyz 5.0.2-20091224.163241-12 [INFO] Retrieving previous metadata from snaphots [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '00766e1a0130c3499442c06b52523960c5860f3c'; remote = 'c9bcfc92b3145688aa8ec77dcac244c70be4d0b4' - RETRYING [WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '00766e1a0130c3499442c06b52523960c5860f3c'; remote = 'c9bcfc92b3145688aa8ec77dcac244c70be4d0b4' - IGNORING [INFO] Uploading repository metadata for: 'snapshot com.myco.xyz:xyz:5.0.2-SNAPSHOT'

like image 716
Peter Kahn Avatar asked Oct 15 '22 11:10

Peter Kahn


1 Answers

You can fail your build due to a bad checksum. Simply configure your repository element - preferably in your settings.xml or inside your repository manager such as nexus.

Example:

<repository>
  <id>central</id>
  <name>My Central Repository</name>
  <url>http://repo1.maven.org/maven2</url>
  <releases>
    <checksumPolicy>fail</checksumPolicy>
  </releases>
  <snapshots>
    <checksumPolicy>fail</checksumPolicy>
  </snapshots>
</repository>

More info here: http://www.sonatype.com/books/maven-book/reference/appendix-settings-sect-settings-repository.html

like image 87
Peter Lynch Avatar answered Oct 18 '22 13:10

Peter Lynch