Maven依赖插件忽略目标文件夹

4
我正在使用命令行中的maven-dependency-plugin下载单个文件,但是它总是被下载到我的本地存储库中,在我的特定用例中,我希望它被下载到当前目录中。
我正在使用2.4版本的插件,应该支持 -Ddestination 作为替代下载站点;然而,我无法使它正常工作。运行调试模式似乎表明目标参数被忽略了...
我正在运行以下命令:
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

我做错了什么?

2个回答

9
请参考文档这里。文档中写道:

表达式:${dest}

这意味着您需要提供名为dest的参数。请尝试使用-Ddest=M:\test.tar命令来指定文件名,而不是目录。此名称应为下载的构件文件名。

1
啊,谢谢你指出来。我之前一直以为预期的表达式会和参数名字一样呢。 :-) - RCross

1
在3.0.0版本中,该属性已被移除。在2.10版本中,目标参数(destination/dest)已被弃用:它将在未来版本中消失。关于此的文档并不一致。在“usage”中,有一个使用属性“dest”的示例,但在here中没有提到它。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接