views:

514

answers:

1

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'

+1  A: 

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&lt;/url&gt;
  <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

Peter Lynch
Thanks, that's just what I was looking for.
Peter Kahn
I can't seem to get this to work. I've set it in my settings file and configured nexus.xml to set the repository policy to fail. In both cases the build is still successful[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '24dab9a242e9e9399cc79221b8ed47af31a37a0f'; remote = '55aac6492bc939be75438399ba6b6002fc0cf3d6bc' - IGNORINGAny ideas what I'm missing?
Peter Kahn

related questions