Skip to content

Instantly share code, notes, and snippets.

@mkobit
mkobit / build.gradle.kts
Last active Aug 9, 2022
Run Kotlin REPL with built source code and main classpath in Gradle
View build.gradle.kts
// Assuming Kotlin plugin is applied...
// Run as: ./gradlew kotlinRepl --console plain --no-daemon
val kotlinRepl by tasks.creating {
description = "Starts Kotlin REPL with compiled main classes and runtime classpath"
val mainSourceSet = java.sourceSets["main"]
dependsOn(mainSourceSet.output)
doFirst {
val buildscriptClasspath = rootProject.buildscript.configurations["classpath"]
@mkobit
mkobit / build.gradle
Created Jul 31, 2017
Gradle - Pin Groovy version in codenarc configuration CodeNarc
View build.gradle
// The 'codenarc' plugin has a configuration with a dynamic Groovy dependency.
// This can be different that the actual version you are using.
// codenarc - The CodeNarc libraries to be used for this project.
// \--- org.codenarc:CodeNarc:0.27.0
// +--- org.gmetrics:GMetrics:0.7
// | +--- org.codehaus.groovy:groovy:[2.1.0,) -> 2.5.0-beta-1
// | +--- org.codehaus.groovy:groovy-xml:[2.1.0,) -> 2.5.0-beta-1
// | | \--- org.codehaus.groovy:groovy:2.5.0-beta-1
// | \--- org.codehaus.groovy:groovy-ant:[2.1.0,) -> 2.5.0-beta-1
// | +--- org.codehaus.groovy:groovy:2.5.0-beta-1