- Kotlin for Enterprise Applications using Java EE
- Raghavendra Rao K
- 127字
- 2021-06-10 18:49:30
Using the no-org plugin in Gradle
Add the plugin in the buildscript dependencies section in the Gradle file:
buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
}
}
apply plugin: "kotlin-noarg"
Alternatively, we can enable the no-arg plugin using Gradle as follows:
plugins {
id "org.jetbrains.kotlin.plugin.noarg" version "1.2.41"
}
We can then specify the list of annotations in the plugin section. The no-arg plugin generates the default constructor for the classes that are annotated with the annotations that we specified in the noArg annotation section of the plugin:
noArg {
annotation("org.rao.kotlin.javaee.MyClass")
}
If we want to execute the initialization of member variables from the default constructor, we can use the invokeInitializers plugin option:
noArg {
invokeInitializers = true
}
推薦閱讀
- 數據科學實戰手冊(R+Python)
- SPSS數據挖掘與案例分析應用實踐
- OpenDaylight Cookbook
- Maven Build Customization
- 編程卓越之道(卷3):軟件工程化
- Internet of Things with Intel Galileo
- Flutter跨平臺開發入門與實戰
- Learning Laravel's Eloquent
- 微服務從小白到專家:Spring Cloud和Kubernetes實戰
- INSTANT Yii 1.1 Application Development Starter
- Mastering Elasticsearch(Second Edition)
- WildFly Cookbook
- 零基礎學編程系列(全5冊)
- 數據結構與算法詳解
- SQL Server 2014數據庫設計與開發教程(微課版)