Skip to content

Instantly share code, notes, and snippets.

@antonarhipov
Last active June 16, 2024 03:05
Show Gist options
  • Save antonarhipov/db4f4002c6a1813d349b to your computer and use it in GitHub Desktop.
Save antonarhipov/db4f4002c6a1813d349b to your computer and use it in GitHub Desktop.
Gradle build for Java web application with Kotlin
buildscript {
ext.kotlin_version = '0.9.976'
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'war'
sourceCompatibility = 1.5
version = '1.0'
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
mavenCentral()
}
sourceSets {
main {
kotlin {
srcDir 'src/main/kotlin'
}
output.resourcesDir = "build/classes/main"
}
test {
kotlin {
srcDir 'test/main/kotlin'
}
}
main.java.srcDirs += 'src/main/kotlin'
}
dependencies {
compile group: 'javax', name: 'javaee-api', version: '7.0'
testCompile group: 'junit', name: 'junit', version: '4.11'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment