[英]Compile gradle with two configuration
I have a gradle project. 我有一个gradle项目。 This project contains many modules. 该项目包含许多模块。 I would like to make 2 differents executables with some module activated or not. 我想制作2个不同的可执行文件,其中一些模块已激活或未激活。 I have one executable with module1 and module2 like follow: 我有一个可执行文件,其中module1和module2如下:
dependencies {
compile project(':module1')
compile project(':module2')
}
I would like a executable with module1 and module2, and another one with only module1. 我想要一个module1和module2的可执行文件,另一个只有module1。
For generate an executable I used launch4j and shadowjar. 为了生成可执行文件,我使用了launch4j和shadowjar。
How I can do that? 我怎么能这样做?
Thanks 谢谢
You could possibly use my java-flavours-plugin 你可以使用我的java-flavors-plugin
plugins {
id "com.lazan.javaflavours" version "1.2"
}
javaFlavours {
flavour 'version1'
flavour 'version2'
}
dependencies {
compile 'some:common-dependency:1.0'
version1Compile project(':module1')
version2Compile project(':module2')
}
Each flavour (eg version1 & version2) will have a jar task, the jar could be consumed by downstream modules/tasks. 每个flavor(例如version1和version2)都有一个jar任务,jar可以被下游模块/任务使用。 You can also reference sourceSets.version1.runtimeClasspath
etc. 您还可以参考sourceSets.version1.runtimeClasspath
等。
Note: The plugin supports flavour specific java sources and resources. 注意:该插件支持特定于flavor的java源和资源。 Not sure if you need that feature. 不确定您是否需要该功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.