Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Andreas Leitgeb Newsgroups: comp.lang.java.programmer Subject: Re: maven and its downloads Date: Thu, 27 Feb 2020 11:30:58 -0000 (UTC) Organization: A noiseless patient Spider Lines: 46 Message-ID: References: <3b5cef64-f28b-447c-a6cc-5b47dfe463ee@googlegroups.com> <5s4fwywkn0w0.1bel7pifsoh00$.dlg@40tude.net> Reply-To: avl@logic.at Injection-Date: Thu, 27 Feb 2020 11:30:58 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="566e8e2316f60fe77023cc31f8e4417e"; logging-data="22077"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DJN+Yrdemyfuq/18qRQhy" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:RuQYqRX+DfcRYjfzZw0uLvBRbmM= Xref: csiph.com comp.lang.java.programmer:39307 Joerg Meier wrote: > On Wed, 26 Feb 2020 16:57:29 -0000 (UTC), Andreas Leitgeb wrote: >> Eric Douglas wrote: >>> On Wednesday, February 26, 2020 at 4:16:26 AM UTC-5, Andreas Leitgeb wrote: >>>> I've got a single maven project on a particular user at a machine. >>>> After some development stages (with often changed dependencies), >>>> I made a full clean+build (took only a few minutes), then used >>>> "find ~/.m2/repository -amin +60 -exec rm {} +" >>>> (remove everything not used in the last 60 minutes) >>>> On next build afterwards, it again downloaded a few packages. >>>> Apparently, it downloads packages that it doesn't ever use. >>>> Majority of them is in org.apache.maven group. >>>> Given that the local repo of that user is used only for that >>>> project, is there a way to prune it of no-longer necessary >>>> stuff, while avoiding to prune stuff that will be re-downloaded? >>> It should download everything in your pom file(s). >>> Are you seeing projects downloaded which are not referenced for download anywhere? >> Yes. Well, not "anywhere in my pom-files". > > Try "mvn dependency:tree -Dverbose" Thanks! I didn't know that. It'll hopefully give me the reasons for presence of some of the packages, although it doesn't seem to mention (Fwiw, it says: "Verbose not supported since maven-dependency-plugin 3.0") >>> Define "doesn't ever use". >> As I wrote: The OS doesn't record any attempt at reading those files >> during the time I do a complete build. > That doesn't mean they aren't "used" in your Maven context. ... > You seem to have misunderstood Eric. Imagine this scenario: in your > pom.xml, you reference a library. That library references Apache POI, which > is a library that can write a spreadsheet. But your code never actually > writes a spreadsheet, so the Apache POI library is never actually used (in > the code you ran). My logic may still be flawed, and I'd appreciate correction: My project uses spring-boot-starter to build a standalone jar-file with everything included (as nested jar-files). So, if my code had (e.g.) any chance to create a spreadsheet using a 3rd-party lib from the repo, then the actual code for creating the spreadsheet would need to be included in the standalone jar, and for that it would *need to be "accessed" during the build*.