簡體   English   中英

Maven依賴插件忽略目標

[英]Maven dependency plugin ignores destination

我正在使用命令行中的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

我究竟做錯了什么?

請查看此處的文檔。 它說:

表達式:$ {dest}

這意味着您必須提供名為dest的參數。 嘗試使用-Ddest=M:\\test.tar 此外,它應該是下載的artefact的文件名,而不是目錄。

在3.0.0版本中,此比例被刪除。 在版本2.10中,不推薦使用destination / dest參數:它將在將來的版本中消失。 這方面的文檔不一致。 在“用法”中有一個帶有“dest”屬性的例子,但在這里沒有關於它的詞。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM