3

I used a snapshot jar in my pom.xml which developed by another team.After a period of time, I found a lots of snapshot jar with timestamp in my local repo like bellows:

base-0.0.1-20190924.065706-10.jar base-0.0.1-20190925.002128-11.jar base-0.0.1-20191107.012927-66.jar base-0.0.1-20191108.002149-68.jar

I knew I can remove them manually, but I think there must be a way to clear them automatically? Dose anybody know it ?

oarsmanli
  • 465
  • 1
  • 3
  • 5
  • 1
    Those are not snapshots! You might want to read this https://stackoverflow.com/questions/5901378/what-exactly-is-a-maven-snapshot-and-why-do-we-need-it and this https://stackoverflow.com/questions/19310650/how-to-clean-old-dependencies-from-maven-repositories – SiKing Nov 08 '19 at 15:33
  • 1
    @JFMeier Could you give me some kind of link to this. The only thing that I can find on snapshots, as far as Maven understands them, is "-SNAPSHOT" in the name convention. – SiKing Nov 08 '19 at 19:15
  • 1
    I don't have a docs about this, but if you look into any Nexus or Artifactory and look at the files that were deployed as `1.2.3-SNAPSHOT`, you see that they are saved in the form `1.2.3-{sometimestamp}-{somenumber}`. – J Fabian Meier Nov 08 '19 at 19:23

1 Answers1

3

mvn dependency:purge-local-repository might help. Take a look at the section about including specific groupId's or artifactId's.

https://maven.apache.org/plugins/maven-dependency-plugin/examples/purging-local-repository.html

Jim Sellers
  • 415
  • 2
  • 13