Gradle distZip配置文件 [英] Gradle distZip config files

查看:1075
本文介绍了Gradle distZip配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过distZip(gradle application插件)安装了一个应用程序。它有bin和lib文件夹。现在,我在哪里放置配置文件?像logback.xml或application.properties等?或者我需要以某种方式告诉插件文件在哪里?

I have an application installed via distZip (gradle application plugin). It has the bin and lib folders. Now where do I place the config files? Like logback.xml or application.properties, etc? Or do I need to somehow tell the plugin where are the files?

推荐答案

当使用Gradle的应用程序插件时,您希望包含在发行版中的任何其他文件或文件夹应放置在 src / dist

When using Gradle's Application plugin, any additional files or folders you want to include the in distribution should be placed in src/dist

您可以参考 45.1.1。 Gradle手册中的分发。 ( https://docs.gradle.org/current/userguide/application_plugin.html

例如,如果您希望配置目录成为应用程序发行版的一部分,您可以像这样布局项目:

Such as if you wanted a config directory to be part of your application distribution you could layout your project like so:

ExampleApplication/
└── src
    └── dist
        └── config
            └── logback.xml

然后当你的分布被创建时,它的顶层将会有一个config目录,其中包含logback.xml

Then when your distribution was created it would have a config directory at the top level containing logback.xml

如果此目录结构对您的项目提出问题,您也可以手动添加文件和文件夹,如下所示:

If this directory structure presents an issue for your project, you can also manually add files and folders like so:

applicationDistribution.from('config') {
    into "config"
}

这篇关于Gradle distZip配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆