且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven:依赖项:get -DoutputDirectory不起作用.(如何将工件及其所有依赖项下载或复制到特定文件夹?)

更新时间:2022-12-12 16:34:43

  mvn -Dmaven.repo.local = someDir依赖项:get ... 

?

您可以在命令行上将任何目录指定为本地存储库,因此 dependency:get 会将结果复制到该目录.

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

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.