maven: how to clean the old snapshot in local repo?
mvn dependency:purge-local-repository might help. Take a look at the section about including specific groupId's or artifactId's.
clean up and maintain local maven cached artifact in .m2
If you don't care that external dependencies are pulled in every build, you could use a private Maven repository per job (Maven -> Advanced -> Check 'use private Maven repository') and clean the workspace at the start of your build. The private repository creates a
.repository in your workspace, so cleaning your workspace will ensure you start with an empty repository.
Should you have many shared external dependencies, then you may be using even more diskspace, since they are present multiple times in the different repositories. In that case you could write a script that periodically (using a task scheduler like
cron) removes unused files from the shared repository, see for example this Stack Overflow answer.
However be cautious with a shared Maven repository! Maven by default is not threadsafe, so concurrent jobs downloading the same artifact might use the incomplete downloads. Consider using the Takari extensions to make your Maven repository thread-safe.
How to remove jar file from local maven repository which was added with install:install-file?
While there is a maven command you can execute to do this, it's easier to just delete the files manually from the repository.
Like this on windows
Documents and Settings\your username\.m2 or
$HOME/.m2 on Linux
How to clear .m2 Maven folder?
It's perfectly safe to delete the folder
.m2/repository as maven will re-download all the needed dependencies when needed except for your local projects. It there any other folder under
.m2 taking space?
For your local projects, maven will complain about not finding them. In that case, you simply need to re-compile them and install them by running
mvn clean install in each project folder. They will get uploaded to the repository.
403 Forbidden When I Try to Post to My Spring API
Java Classes to Generate the Given Json String
Java Regex to Validate Full Name Allow Only Spaces and Letters
Java: How to Check If Object Is Null
Find Everything Between Two Xml Tags With Regex
Createprocess Error=2, the System Cannot Find the File Specified
Tomcat Server Error - Port 8080 Already in Use
Update Objects in One List Based on Values from Second One Using Streams
How to Pass Topics Dynamically to a Kafka Listener
Caused By: Org.Flywaydb.Core.Api.Flywayexception: Validate Failed. Migration Checksum Mismatch for Migration 2
Is There a Java Setting for Disabling Certificate Validation
Write a Program That Keeps Taking in Integers Until a Negative Integer Is Given. Then Take All the Positive Integers and Get the Average of Them All
How to Handle JPA Unique Constraint Violations
How to Identify File Type by Base64 Encoded String of a Image
How to Map Json Field Names to Different Object Field Names
How to Clean Old Dependencies from Maven Repositories
How to Skip @Postconstruct When Unit Testing
Jpa:How to Convert a Native Query Result Set to Pojo Class Collection