3

我正在使用命令行中的 maven-dependency-plugin 下载单个文件,但它总是在我的本地存储库中结束,对于我的特定用例,我希望将它下载到当前目录。

我正在使用插件的 2.4 版本,它应该支持 -Ddestination 作为备用下载站点;但是,我无法让它工作。在调试模式下运行 maven 似乎表明目标参数被忽略了......

我正在运行以下内容:

M:\>mvn -e -X org.apache.maven.plugins:maven-dependency-plugin:2.4:get \
-Ddestination=M:\test \
-DremoteRepositories=http://nexus-repo:8080/nexus/content/repositories/snapshots \
-Dartifact=com.company.Common:CommonLibs:1.12.0-SNAPSHOT:tar \
-Dtransitive=false

...但是得到这个...

[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-dependency-plugin:2.4:get' -->
[DEBUG]   (f) artifact = com.company.Common:CommonLibs:1.12.0-SNAPSHOT:tar
[DEBUG]   (f) localRepository = Repository[local|file://C:\Subversion\LocalMavenRepo]
[DEBUG]   (f) packaging = jar
[DEBUG]   (f) pomRemoteRepositories = [Repository[central|http://repo1.maven.org/maven2]]
[DEBUG]   (f) remoteRepositories = http://nexus-repo:8080/nexus/content/repositories/snapshots
[DEBUG]   (f) repositoryId = temp
[DEBUG]   (f) transitive = false
[DEBUG] -- end configuration --
[INFO] [dependency:get {execution: default-cli}]
[DEBUG] Skipping disabled repository central
[INFO] snapshot com.company.Common:CommonLibs:1.12.0-SNAPSHOT: checking for updates from temp
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http

我究竟做错了什么?

4

2 回答 2

8

在此处查看文档。它说:

表达式:${dest}

这意味着您必须提供名为的参数dest。尝试使用-Ddest=M:\test.tar. 此外,它应该是下载工件的文件名,而不是目录。

于 2012-02-23T14:51:42.133 回答
1

在 3.0.0 版本中,此属性已被删除。在 2.10 版本中,destination/dest 参数已被弃用:它将在未来版本中消失。这方面的文档并不一致。在“用法”中有属性“dest”的示例,但在这里没有关于它的消息。

于 2019-07-04T11:50:57.613 回答