2

I'm having a lot of problems lately with Maven 3.5.0 downloading corrupted JARs.

I don't know why, it could be a problem with my workplace's network, the repos we use, or just my computer. Anyway, usually it's easy to solve them, I just need to delete the jar from .m2/repository and force a new download. But it's making me waste a lot of time, specially because sometimes I can't tell there is a problem at all until I'm already deploying the war to the server.

Is there any command prompt, or a parameter I could add to my settings file, so that Maven would check the integrity of each downloaded jar and pom, and redownload them automatically if needed?

AJPerez
  • 3,435
  • 10
  • 61
  • 91
  • 2
    By default the checksum policy is set to `warn` so you should set this to `fail` see https://maven.apache.org/settings.html – khmarbaise Aug 29 '18 at 09:51
  • Thanks. I'll set it to `fail`, although it probably will help only with the Central repo. The other ones I use are corporate and government maintained repositories... and [seeing as Maven doesn't generate the checksums by default](https://stackoverflow.com/questions/3865343/maven-checksum-pom-setting) with a `install`, I doubt there will be any created. – AJPerez Aug 30 '18 at 05:46
  • 1
    For SNAPSHOT's that's true otherwise your configuration is wrong... – khmarbaise Aug 30 '18 at 07:00

1 Answers1

1

As far as I know there were some bugs in Maven 3.5.0 that causes corrupt jars to be uploaded to your Maven repository. I would suggest you update to the latest Maven 3.5.x version and look if that fixes your problem, because I think Maven always verifies the downloaded jars.

funfried
  • 605
  • 3
  • 14
  • Thank you, I'll update to 3.5.4 and see if it makes any improvement (along with the `fail` option suggested in the comments). But I'm not uploading artifacts to any repository, just downloading them to my .m2 folder. – AJPerez Aug 30 '18 at 05:50
  • @funfried can you be more specific here which bugs you are talking about? – khmarbaise Sep 01 '18 at 10:52
  • @khmarbaise I wasn't able to find the ticket for this bug, but I also think I mixed it up with corrupted checksum files when deploying jars to a maven repository. – funfried Nov 02 '18 at 08:29