I installed the jar in the local repository with the command:

mvn install:install-file -Dfile=aaa.jar -DgroupId=bbb -DartifactId=ccc -Dversion=1.0 -Dpackaging=jar 

Now I want to remove it. I try:

mvn dependency:purge-local-repository -DmanualInclude=bbb-ccc

I get the error:

[ERROR] Failed to execute goal. Org.apache.maven.plugins: maven-dependency-plugin: 2.8: purge-local-repository (default-cli): ..). Please verify you invoked Maven from the correct directory. -> [Help 1] `

Now I create the pom.xml pom.xml :

 <?xml version="1.0" encoding="UTF-8"?> <project> <groupId>bbb</groupId> <artifactId>ccc</artifactId> <version>1.0</version> <modelVersion>4.0.0</modelVersion> <packaging>jar</packaging> <properties> <groupId>${project.groupId}</groupId> <artifactId>${project.artifactId}</artifactId> <version>${project.version}</version> <packaging>${project.packaging}</packaging> <file>aaa.jar</file> </properties> </project> 

Now without the problem is removed. Can you still delete the jar without this pom.xml ?

I use 3.2.5 (windows x64).

    2 answers 2

    Of course, you can simply delete the directory with artifacts from the local repository. For linux it will be like this:

     rm -R {user_directory}/.m2/repository/{groupId}/{artifactId}/{version} 
    • Yes, understand. I just wanted to delete, as well as add via mvn. But apparently so it is impossible (I leave aside the question, but why remove it at all). - Yura Shinkarev
    • the only advantage of Maven's simple cork cache is that you can go there and erase what you need. So yes, exactly. - JBaruch
    • There was still a bug, now in the post below I will write it off. - Yura Shinkarev

    I missed that for purge-local-repository there was a requirement of an existing project and, accordingly, pom.xml.

    Another point is that manualInclude should work without pom.xml . But did not work. As I understand - already fixed .