0

I have Apache Maven 3.6.3 and due internet connections issues the local repository is corrupted.

I had this experience few times before, and normally the unique approach to resolve this situation is deleting manually all the content of the local repository and download all again.

Due automation purposes through bash/shell I need a command through Maven to delete all the content within the local repository defined through the settings.xml file

I read this post:

And theoretically the command is:

  • mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false

Well it does not work. It download all again.

Note: not sure if the following would be related with the situation that the command does not work how is expected, but I have the local repository in a different place than the default location than .m2\repository, for example /user_name/apache/maven/repository

Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
  • I do not quite understand. If you want to automate this in a bash/shell, why not use bash/shell commands to remove that directory. Why do you need a Maven goal for this? – J Fabian Meier May 27 '20 at 15:20
  • Just in case if Maven accomplish an internal goal or control prior and before to delete the local repository - perhaps some internal cache log control – Manuel Jordan May 27 '20 at 15:22
  • I doubt that Maven makes any consistency checks on the local repository. – J Fabian Meier May 27 '20 at 15:28
  • 1
    I always recommend to turn on checksum strategy .. https://blog.soebes.de/blog/2018/10/13/maven-artifact-checksums-what/ and no Maven has no consistency check on the local repository... – khmarbaise May 27 '20 at 15:32
  • Thanks, for the link. And wondering if Maven has a command that indicates if the local repository is stable or not (corruption due incorrect download) – Manuel Jordan May 27 '20 at 15:34
  • 1
    No. You have to configure that before the first build (or more accurate before the first download). Apart from that there is no indicator for "local repository is stable" ... – khmarbaise May 27 '20 at 17:24

0 Answers0