- 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
}
推薦閱讀
- ExtGWT Rich Internet Application Cookbook
- OpenDaylight Cookbook
- arc42 by Example
- PHP+MySQL網站開發技術項目式教程(第2版)
- Apache Spark Graph Processing
- 零基礎學Java程序設計
- MySQL數據庫管理與開發實踐教程 (清華電腦學堂)
- 差分進化算法及其高維多目標優化應用
- OpenShift在企業中的實踐:PaaS DevOps微服務(第2版)
- 手把手教你學C語言
- 3D少兒游戲編程(原書第2版)
- Android 應用案例開發大全(第3版)
- 算法訓練營:提高篇(全彩版)
- Responsive Web Design by Example
- 程序是怎樣跑起來的(第3版)