将项目依赖项复制到文件夹

编程入门 行业动态 更新时间:2024-10-28 06:26:23
本文介绍了将项目依赖项复制到文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是Gradle的新手.我正在尝试将项目中的所有依赖项都复制到文件夹build/lib中.可以这样做吗?

I new to Gradle. I'm trying to have all dependencies from my project copied to folder build/lib. Is it possible to do that?

当前,我通过分发插件在构建/分发中有一个.zip和一个.tar.但是,我只想拥有未压缩的库.

Currently, I have a .zip and a .tar in build/distributions via the distribution plugin. However, I would like to have just the uncompressed libs.

此处,我似乎是一个可能的解决方案,但是我想将此作为主要版本的一部分而不是单独的任务.

I've seem a possible solution here, however I would like to have this as part of the main build and not as a separated task.

推荐答案

只需将任务作为依赖项添加到 build .这样,它将成为主要构建的一部分".

Just add the task as a dependency to build. That way it will be "part of the main build".

task copyDependencies(type: Copy) { from configurations.runtimeClasspath // And/or: from configurationspileClasspath into "$buildDir/lib" } build.dependsOn copyDependencies

当然,您也可以将其连接到用于构建或部署应用程序的任何其他任务.

You can, of cause, also hook it up to any other task that you use to build or deploy the application.

只是在您不知道的情况下,也可以使用分发插件中的 installDist 任务(与应用程序插件结合使用)在 $ buildDir中创建分解版本./install .

Just in case you are not aware of it, you can also use the installDist task from the distribution plugin (in combination with the application plugin) to create an exploded version in $buildDir/install.

更多推荐

将项目依赖项复制到文件夹

本文发布于:2023-11-14 16:48:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588000.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   项目

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!