-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
75 lines (61 loc) · 2.03 KB
/
build.gradle.kts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// import org.jetbrains.kotlin.gradle.dsl.Coroutines
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
//group = "jfserver"
//version = "0.1"
val mainKotlinClassName = "com.github.fserver.command.Command"
val mainJavaClassName = "${mainKotlinClassName}Kt"
plugins {
application
kotlin("jvm") version "1.3.50"
id("java")
}
application {
mainClassName = mainJavaClassName
}
dependencies {
compile(kotlin("stdlib"))
compile("io.javalin:javalin:3.6.0")
compile("org.slf4j:slf4j-simple:1.7.29")
compile("com.github.ajalt:clikt:2.3.0")
// See: https://github.com/mwanji/toml4j
compile("com.moandjiezana.toml:toml4j:0.7.2")
compile("org.apache.pdfbox:pdfbox:2.0.17")
}
repositories {
// jcenter()
mavenCentral()
}
sourceSets {
// Change source directory
getByName("main").java.srcDirs("src")
// Set resources directory:
// see: https://qiita.com/aya_n/items/d1fdf817a553ccfe6a22
getByName("main").resources.srcDirs("resources")
}
// Reference: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html?_ga=2.248692736.646913499.1573843899-716276975.1562400899
val runServer = task("runServer", type = JavaExec::class )
{
classpath = sourceSets.main.get().runtimeClasspath
main = mainJavaClassName
args("mdir", "--port=9080"
// , "--auth=user:pass"
,"--pdf", "--upload", "--showpath", "home:~", "desktop:~/Desktop", "here:.")
}
// ========>>> Optional: Used for builduing fat-jar <<==========//
val fatJar = task("fatJar", type = Jar::class) {
// baseName = "${project.name}-fat"
baseName = "fserver-fat"
manifest {
attributes["Implementation-Title"] = "Gradle Jar File Example"
// attributes["Implementation-Version"] = version
attributes["Main-Class"] = "${mainJavaClassName}"
}
from(configurations.runtimeClasspath.get().map({ if (it.isDirectory) it else zipTree(it) }))
with(tasks.jar.get() as CopySpec)
}
tasks {
"build" {
dependsOn(fatJar)
}
}