什么是 Maven 依赖:purge-local-repository 应该做什么?

什么是 Maven 依赖:purge-local-repository 应该做什么?

问题描述:

我正在尝试在启动发布之前清除项目依赖项的本地存储库,以确保所需的每个依赖项都在*存储库中并从中下载.

I'm trying to purge the local repository of a project dependency before launching releasing it in order to make sure every dependency required is on the central repository and is downloaded from it.

在项目文件夹(包含 pom.xml)中,我启动以下命令:

In the project folder (containing the pom.xml), I launch the following command:

mvn clean dependency:purge-local-repository -DreResolve=false -Dverbose=true

项目的 POM 非常简单,只声明了对 junit:junit:3.8.1 的依赖

The project's POM is very simple and just have a declared dependency to junit:junit:3.8.1

命令的输出给了我:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building corelib-api 0.1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ corelib-api ---
[INFO] Deleting d:\Users\fpaillard\git-repositories\TEST_CORELIB\corelib-api\target
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building corelib-api 0.1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:purge-local-repository (default-cli) @ corelib-api ---
[WARNING] Missing POM for junit:junit:jar:3.8.1
[INFO] Skipping: corelib-api. It cannot be resolved.
[INFO] Nothing to do for project: test:corelib-api:jar:0.1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.953s
[INFO] Finished at: Mon May 14 11:34:40 CEST 2012
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------

当我查看本地存储库(使用 mvn help:effetive-settings 检查路径)时,junit JAR 和 POM 仍在 .m2/repository/junit/junit/3.8 中.1 文件夹.

When I look in the local repository (path checked with mvn help:effetive-settings), junit JARs nor POMs are still in .m2/repository/junit/junit/3.8.1 folder.

dependency:purge-local-repository 不是应该删除吗?

我不明白上面输出的警告.为什么缺少 junit:junit:jar:3.8.1 POM?它仍然存在于 .m2/repository/junit/junit/3.8.1/junit-3.8.1.pom

I don't understand the WARNING of the output above. Why is junit:junit:jar:3.8.1 POM missing? It is still present at .m2/repository/junit/junit/3.8.1/junit-3.8.1.pom

问题是否与INFO行Skipping: corelib-api有关.无法解决.?corelib-api 是我针对 mvn dependency:purge-local-repository 运行的项目的工件名称.

Is the problem related to the INFO line Skipping: corelib-api. It cannot be resolved.? corelib-api is the artifact name of the project I ran mvn dependency:purge-local-repository against.

我知道这是旧的,但我遇到了同样的问题,在命令行中添加 -DactTransitively=false 解决了这个问题.我不知道为什么它有帮助,但它确实......

I know this is old, but I had the same issue, and adding -DactTransitively=false to the command line fixed this issue. I'm unable to tell why it helped, but it did...

我希望这会有所帮助.