티스토리 뷰

Tech

Kotlin - Hello World + Gradle Setting

밤백수 2018. 10. 2. 15:36

코틀린, 왜?

Kotlin을 쉽게 결론내면, Java와 Scala의 혼종이 아닐까 싶다.
JVM의 패왕Java.
개발자들이 Java의 문법에 지쳐갈 때 쯤... Scala가 나왔다.
FP. Functional Programming를 표방하면서...
 
FP와 OOP의 어느 중간쯤에서 태어난 혼종.
 

Hello World

package sample

fun main(args : Array) {
	println("Hello, world!")
}

 

Gradle

현재 시점 2018-10-02 JDK8까지 지원.
plugins {
	id 'org.jetbrains.kotlin.jvm' version '1.2.71'
}
ext {
	lombok_version = '1.18.2'
	spring_boot_version = '2.0.5.RELEASE'
	junit_version = '4.12'
	java_version = '1.8'
}

apply plugin: 'idea'
apply plugin: 'eclipse'

group 'archmagece'
version '1.0-SNAPSHOT'

sourceCompatibility = java_version
targetCompatibility = java_version
compileKotlin {
	kotlinOptions.jvmTarget = java_version
	kotlinOptions.freeCompilerArgs = ['-Xjsr305=strict']
}
compileTestKotlin {
	kotlinOptions.jvmTarget = java_version
	kotlinOptions.freeCompilerArgs = ['-Xjsr305=strict']
}

idea {
	module {
		downloadJavadoc = true
		downloadSources = true
	}
}
eclipse {
	classpath {
		downloadJavadoc = true
		downloadSources = true
	}
}

repositories {
	mavenCentral()
	jcenter()
	mavenLocal()
	maven {
		url "https://plugins.gradle.org/m2/"
	}
}

dependencies {
	compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
	testCompile "org.jetbrains.kotlin:kotlin-test"
	testCompile "org.jetbrains.kotlin:kotlin-test-junit"

	//logging
	compile "org.springframework.boot:spring-boot-starter-logging:$spring_boot_version"

	testImplementation "junit:junit:$junit_version"
}

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함