Add gradle plugin configuration example with Kotlin script
See original GitHub issuePlease add Kotlin script equivalent code. Currently it is only in the Groovy:
import gg.jte.ContentType
import java.nio.file.Paths
plugins {
id 'java'
id 'gg.jte.gradle' version '${jte.version}'
}
dependencies {
implementation('gg.jte:jte:${jte.version}')
}
tasks.precompileJte {
sourceDirectory = Paths.get(project.projectDir.absolutePath, "src", "main", "jte")
targetDirectory = Paths.get(project.projectDir.absolutePath, "jte-classes")
compilePath = sourceSets.main.runtimeClasspath
contentType = ContentType.Html
}
tasks.precompileJte {
dependsOn(tasks.compileJava)
}
tasks.test {
dependsOn(tasks.precompileJte)
}
Struggling with converting this part to Kotlin:
tasks.precompileJte {
sourceDirectory = Paths.get(project.projectDir.absolutePath, "src", "main", "jte")
targetDirectory = Paths.get(project.projectDir.absolutePath, "jte-classes")
compilePath = sourceSets.main.runtimeClasspath
contentType = ContentType.Html
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Developing Custom Gradle Plugins
In our examples, we are going to use Java as the implementation language for standalone plugin project and Groovy or Kotlin in the...
Read more >Configure a Gradle project - Kotlin
To build a Kotlin project with Gradle, you need to add the Kotlin Gradle plugin to your build script file build.gradle(.kts) and configure...
Read more >How to write a Gradle plugin in Kotlin | by Rui Rosario - Medium
The first enables the Gradle Dependency Injection capabilities — in our case it injects the name of the configuration to use for our...
Read more >The New Way of Writing Build Gradle with Kotlin DSL
the basic thing when you change Gradle using Kotlin script is the use of single-quotes to double-quotes. For minSdkVersion and targetSdkVersion is function...
Read more >How to Create Gradle Plugin in Kotlin - Droids On Roids
There are many tutorials about writing custom Gradle plugins on the Internet. For example this official one. However, most of them use Groovy ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So here is what I ended up with:
You may post this one into docs, but edit
sourceDirectory
andtargetDirectory
to match your Groovy example, because I have a bit different ones.Definitely, this is better and shorter mess than Maven.