How can I execute the opposite of mvn install from a script that does not know the name of the artifact or group ID of the artifact being uninstalled? [duplicate]

丶灬走出姿态 提交于 2019-12-04 02:52:51

Here's one way that seems to work (though a bit clumsy).

This removes all dependencies of the project:

mvn dependency:purge-local-repository -DreResolve=false

And this removes the main artifact itself:

mvn dependency:purge-local-repository -DmanualInclude=${project.groupId}:${project.artifactId}:${project.version}

Two steps are required, because

manualIncludes:

The list of dependencies in the form of groupId:artifactId which should BE deleted/purged from the local repository. Note that using this parameter will deactivate the normal process for purging the current project dependency tree. If this parameter is used, only the included artifacts will be purged. The manualIncludes parameter should not be used in combination with the includes/excludes parameters.

(see the plugin doc)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!