且构网

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

Gradle distZip配置文件

更新时间:2023-01-11 16:55:05

当使用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"
}