Maven: dependency:get -DoutputDirectory doesn'

2019-08-17 14:17发布

问题:

I try the following way but it doesn't work.

mvn dependency:get -Dartifact=com.android.tools.build:gradle:3.4.0-alpha07 -DoutputDirectory=C:\Users\username\Desktop\MyFolder

Does anyone know another way of achieving my goal?

My goal is to download an artifact with all its dependencies in a folder.

The dpendency:copy-dependencies command only copies jar files, but I want to have an artifact with all its dependencies like the local repository folder structure. for example the photo below shows an artifact with all its dependencies that have been downloaded from the maven repository (I want this).

I download this artifact with all its dependencies with dependency:get command and then be stored in the local repository and combined with other folders that are in the local repository.

How am I to copy this artifact, along with all its dependencies from the local repository (or maven repository) to another folder.

I don't want to use the dependency:copy-dependencies command because it only copies jar files, but I want files and folders, as they are downloaded with dependency:get command (like the local repository folder structure).

Unfortunately, the following command does not store files and folders in the location I want.

mvn dependency:get -Dartifact=com.android.tools.build:gradle:3.4.0-alpha07 -DoutputDirectory=C:\Users\username\Desktop\MyFolder

回答1:

What about

mvn -Dmaven.repo.local=someDir dependency:get ...

?

You can specify any directory as local repository on the command line, so dependency:get will copy the results to that directory.