简体   繁体   中英

Maven dependency plugin ignores destination

I'm using the maven-dependency-plugin from the command line to download a single file, but it always ends up in my local repository when, for my particular use case, I want it to be downloaded to the current directory.

I'm using version 2.4 of the plugin, which should support -Ddestination as an alternate download site; however, I can't get it to work. Running maven in debug mode seems to indicate that the destination parameter is being ignored...

I'm running the following:

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

... but getting this...

[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

What am I doing wrong?

Look in the documentation here . It says:

Expression: ${dest}

It means you have to provide the parameter named dest . Try to use -Ddest=M:\\test.tar . Also, it should be file name for the downloaded artefact, not a directory.

In version 3.0.0 this proporty is removed. In version 2.10 destination/dest parameter is deprecated: it will disappear in future version. Documentation for this is not consistent. In "usage" there is example with property "dest" but in here there is no word about it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM