Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 736
RCross Avatar asked Oct 30 '25 03:10

RCross


2 Answers

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.

like image 119
kan Avatar answered Oct 31 '25 16:10

kan


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.

like image 27
Rafał Jankowski Avatar answered Oct 31 '25 16:10

Rafał Jankowski