gpt4 book ai didi

java - 我可以在没有 pom.xml 的情况下从本地存储库中删除 jar 吗?

转载 作者:塔克拉玛干 更新时间:2023-11-01 23:06:32 26 4
gpt4 key购买 nike

我通过命令将我的 jar 安装到本地存储库:

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

现在我想从存储库中删除它。我尝试命令:

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

但是报错:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:purge-local-repository (default-cli): Goal requires a project to execute but there is no POM in this directory (...). Please verify you invoked Maven from the correct directory. -> [Help 1]

然后我用数据创建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>

现在我可以从存储库中删除 jar。但是我可以在不创建 pom.xml 的情况下通过命令行删除吗?

我使用的是 3.2.5 (windows x64)。

最佳答案

dependency:purge-local-repository目标,到现在2.10版本,需要在Maven工程上执行:

Requires a Maven project to be executed.

此目标的目的之一是从本地存储库中删除 Maven 项目的依赖项,因此它需要一个才能执行。这解释了您遇到的错误。

但是,使用这个插件,可以指定一个 manualInclude参数,这将删除指定为 groupId:artifactId:version 或所有版本的 groupId:artifactId 甚至 groupId 下的所有依赖项。因此,插件可以更新为不需要执行 Maven 项目。

我继续,创建了 JIRA 问题 MDEP-537跟踪此添加并将在 3.0.0 版中修复此问题。

关于java - 我可以在没有 pom.xml 的情况下从本地存储库中删除 jar 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38973960/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com