score:73
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.
score:-3
Just open eclipse-->window-->preferences-->maven-->user settings-->in there see "local repository location". then find the location for your .m2/repository folder then delete that folder if your maven doesn't work properly.
score:3
Maven downloads all dependencies to a folder .m2/repository
in the user's home directory (i.e. C:\users\[your user name]\.m2\repository
on Windows.
When you delete this folder, Maven creates the folder and downloads the dependencies for the projects you're building from then on.
If you want to change the folder to another directory, you can put a Maven configuration file settings.xml
in the .m2
directory.
You can find a sample file in your Maven distribution in the conf
directory.
Then look for the entry localRepository
which should be commented out like this:
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
Activate it an set it to the path you like, e.g. make Maven download the dependencies to D:\myMavenRepository
set it to
<localRepository>D:/myMavenRepository</localRepository>
score:3
For an Ubuntu/Linux environment, use the below command to point to a new m2 directory without deleting the existing one.
mvn clean install -Dmaven.repo.local=/home/ishara/newm2
score:10
Solution 1:
You can even create new folder in D drive or any other drive.
And use it.
Not necessary that you use .m2 folder created by default.
Also change this to new path:
<localRepository>D:\.m2\repository_Product</localRepository>
Change setting as shown in image below:
Solution 2:
delete .m2 folder and then make sure that all the projects are having only new versions/required version of jar entry in pom.xml. Re-build the project. The .m2 folder will remain with only latest version
Tip: Keep your IDE and required projects open so that it will be prevented from deletion.
Source: stackoverflow.com
Related Query
- How to include a config file in the "META-INF/services" folder of a JAR using Maven
- How to clear .m2 Maven folder?
- How to config TestNG test-output folder to be inside Maven target folder?
- How to define source folder order in maven pom file?
- How can i add images in source folder of a Maven Java Project?
- how to delete target folder of maven project in eclipse
- How to include folder with resource in Maven build
- How to refer jars in Maven which are present in the project's lib folder and not in repository?
- In Eclipse, how do I exclude test folder of one maven project from another project that has as a dependency?
- Can't see how to tell Maven to install jars on lib folder
- How to organize maven dependencies into single Maven Dependencies library folder
- How to set relative path for a folder in Maven java web application?
- How to make resources in maven test folder available to other projects
- How to regenerate target folder on Maven 'package'?
- Maven Eclipse: How to include custom folder (with files) into the "target" folder on build?
- How to connect/sync just the src folder of the maven project in eclipse workspace to src folder in repository
- How to add resource folder to the my EJB jar by maven
- How do I configure Eclipse and Maven to not duplicate folder listings?
- How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds
- How to fix error "Updating Maven Project". Unsupported IClasspathEntry kind=4?
- How do I enable index downloads in Eclipse for Maven dependency search?
- What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?
- How do I add a Maven dependency in Eclipse?
- How to configure Eclipse build path to use Maven dependencies?
- How to install Maven artifact with sources from command line?
- How to update maven repository in Eclipse?
- Creating a src/main/java folder structure in Eclipse without Maven
- How do you clear the validation errors in Eclipse?
- How to exclude a folder that is producing warnings/errors in an Eclipse project?
- How do I get Eclipse to resolve classes generated with Maven 2?
More Query from same tag
- <ClassName> extends non-API type <SuperclassName>
- Insert input in Eclipse console - Java
- Why the cancelation of eclipse update is so slow?
- Generate installer including Jar File and Mysql db
- Maven - compilation error even if dependency path is correct
- How to create a war file using terminal
- How can I add specific header file to index as if it was included in eclipse cdt?
- Eclipse on Windows 7
- Cannot get test result if running over 1000 Test cases in selenium python
- How use debug in Eclipse correctly?
- Is it possible to assert a combination of elements
- Changing progress bar color using XML in Android app
- Should I store git repository in Home or Eclipse Workspace?
- Auto screen orientation is not working one user ser screen orientation android
- SpringBoot: How to provide VM Argument in Spring Boot App, while running from Eclipse
- Eclipse Juno and Retina Resolution
- Didn't find class “com.google.firebase.provider.FirebaseInitProvider, While upgrading the apk from eclipse with studio build
- Eclipse Shortcut for Android Lifecycle methods
- Debugging maven junit tests with filtered resources?
- How to resolve JDK version mismatch between compiled class version and runtime version?
- I am not able to render the editText properly
- To develop in Android is it an absolute necessity to use Eclipse?
- Setting up Java and Eclipse IDE - Redundant installations
- Error in connecting Eclipse to SQL Server
- Video Live wallpaper android
- Eclipse Maven dependencies in Run Configurations?
- Eclipse refactor overridden method into final and abstract parts
- Android Program Name - What determines this name in Eclipse?
- How to set "tabs only"-policy for XML-files in eclipse?
- Zooming out dispositiong image with custom imageView