or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

compilation-tasks.mddependency-management.mddsl-extensions.mdindex.mdjavascript-webassembly.mdmultiplatform-targets.mdplugin-configuration.md

plugin-configuration.mddocs/

0

# Plugin Configuration

1

2

This document covers the core plugin application patterns and entry points for different types of Kotlin projects.

3

4

## Plugin Entry Points

5

6

### JVM Plugin

7

8

For standard Kotlin/JVM projects targeting the Java Virtual Machine.

9

10

```kotlin { .api }

11

plugins {

12

id("org.jetbrains.kotlin.jvm") version "2.2.0"

13

}

14

```

15

16

**Usage Example:**

17

18

```kotlin

19

plugins {

20

id("org.jetbrains.kotlin.jvm") version "2.2.0"

21

id("application")

22

}

23

24

application {

25

mainClass.set("com.example.MainKt")

26

}

27

28

kotlin {

29

jvmTarget = "11"

30

}

31

```

32

33

### Multiplatform Plugin

34

35

For Kotlin Multiplatform projects targeting multiple platforms.

36

37

```kotlin { .api }

38

plugins {

39

id("org.jetbrains.kotlin.multiplatform") version "2.2.0"

40

}

41

```

42

43

**Usage Example:**

44

45

```kotlin

46

plugins {

47

id("org.jetbrains.kotlin.multiplatform") version "2.2.0"

48

}

49

50

kotlin {

51

jvm()

52

js(IR) {

53

browser()

54

}

55

iosX64()

56

iosArm64()

57

}

58

```

59

60

### Android Plugin

61

62

For Kotlin/Android projects, used alongside the Android Gradle Plugin.

63

64

```kotlin { .api }

65

plugins {

66

id("com.android.application") // or com.android.library

67

id("org.jetbrains.kotlin.android") version "2.2.0"

68

}

69

```

70

71

**Usage Example:**

72

73

```kotlin

74

plugins {

75

id("com.android.application")

76

id("org.jetbrains.kotlin.android") version "2.2.0"

77

}

78

79

android {

80

compileSdk = 34

81

82

compileOptions {

83

sourceCompatibility = JavaVersion.VERSION_11

84

targetCompatibility = JavaVersion.VERSION_11

85

}

86

}

87

88

kotlin {

89

jvmTarget = "11"

90

}

91

```

92

93

### JavaScript Plugin

94

95

For Kotlin/JS projects targeting JavaScript runtimes.

96

97

```kotlin { .api }

98

plugins {

99

id("org.jetbrains.kotlin.js") version "2.2.0"

100

}

101

```

102

103

**Usage Example:**

104

105

```kotlin

106

plugins {

107

id("org.jetbrains.kotlin.js") version "2.2.0"

108

}

109

110

kotlin {

111

js(IR) {

112

browser {

113

webpackTask {

114

outputFileName = "app.js"

115

}

116

}

117

}

118

}

119

```

120

121

## Subplugins

122

123

### KAPT (Kotlin Annotation Processing Tool)

124

125

For annotation processing in Kotlin projects.

126

127

```kotlin { .api }

128

plugins {

129

id("org.jetbrains.kotlin.kapt") version "2.2.0"

130

}

131

```

132

133

**Usage Example:**

134

135

```kotlin

136

plugins {

137

id("org.jetbrains.kotlin.jvm") version "2.2.0"

138

id("org.jetbrains.kotlin.kapt") version "2.2.0"

139

}

140

141

dependencies {

142

kapt("com.google.dagger:dagger-compiler:2.48")

143

implementation("com.google.dagger:dagger:2.48")

144

}

145

```

146

147

### Parcelize

148

149

For Android Parcelable generation.

150

151

```kotlin { .api }

152

plugins {

153

id("org.jetbrains.kotlin.plugin.parcelize") version "2.2.0"

154

}

155

```

156

157

### AllOpen

158

159

For making classes open for frameworks like Spring.

160

161

```kotlin { .api }

162

plugins {

163

id("org.jetbrains.kotlin.plugin.allopen") version "2.2.0"

164

}

165

166

allOpen {

167

annotation("org.springframework.stereotype.Component")

168

}

169

```

170

171

### NoArg

172

173

For generating no-argument constructors.

174

175

```kotlin { .api }

176

plugins {

177

id("org.jetbrains.kotlin.plugin.noarg") version "2.2.0"

178

}

179

180

noArg {

181

annotation("jakarta.persistence.Entity")

182

}

183

```

184

185

### Scripting

186

187

For Kotlin scripting support.

188

189

```kotlin { .api }

190

plugins {

191

id("org.jetbrains.kotlin.plugin.scripting") version "2.2.0"

192

}

193

```

194

195

## Plugin Classes

196

197

The actual plugin implementation classes (for advanced usage or plugin development).

198

199

```kotlin { .api }

200

// Main plugin wrappers

201

class KotlinPluginWrapper : AbstractKotlinPluginWrapper()

202

class KotlinMultiplatformPluginWrapper : AbstractKotlinMultiplatformPluginWrapper()

203

class KotlinAndroidPluginWrapper : AbstractKotlinAndroidPluginWrapper()

204

class KotlinJsPluginWrapper : AbstractKotlinJsPluginWrapper()

205

206

// Base plugin classes

207

abstract class KotlinBasePluginWrapper : Plugin<Project>

208

abstract class AbstractKotlinPluginWrapper : KotlinBasePluginWrapper()

209

abstract class AbstractKotlinMultiplatformPluginWrapper : KotlinBasePluginWrapper()

210

```

211

212

## Plugin Constants

213

214

```kotlin { .api }

215

const val KOTLIN_DSL_NAME = "kotlin"

216

const val KOTLIN_OPTIONS_DSL_NAME = "kotlinOptions"

217

const val KOTLIN_PROJECT_EXTENSION_NAME = "kotlin"

218

```

219

220

## Version Compatibility

221

222

The plugin version should match or be compatible with the Kotlin compiler version being used:

223

224

```kotlin

225

// Plugin version matches Kotlin version

226

plugins {

227

id("org.jetbrains.kotlin.jvm") version "2.2.0"

228

}

229

230

dependencies {

231

implementation("org.jetbrains.kotlin:kotlin-stdlib:2.2.0")

232

}

233

```