add fatJar

This commit is contained in:
Aria Moradi 2021-01-20 03:05:40 +03:30
parent a7e63565ef
commit ace471abdb
6 changed files with 78 additions and 3 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@
# Ignore Gradle build output directory
build
server/src/main/resources/react

View File

@ -1,6 +1,9 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
// id("org.jetbrains.kotlin.jvm") version "1.4.21"
application
id("com.github.johnrengelman.shadow") version "6.1.0"
}
@ -84,5 +87,43 @@ dependencies {
}
application {
mainClass.set("ir.armor.tachidesk.Main")
val name = "ir.armor.tachidesk.Main"
mainClass.set(name)
// Required by ShadowJar.
mainClassName = name
}
sourceSets {
main {
resources {
srcDir("src/main/resources")
}
}
}
tasks {
jar {
manifest {
attributes(
mapOf(
"Main-Class" to "com.example.MainKt", //will make your jar (produced by jar task) runnable
"ImplementationTitle" to project.name,
"Implementation-Version" to project.version)
)
}
}
shadowJar {
manifest.inheritFrom(jar.get().manifest) //will make your shadowJar (produced by jar task) runnable
}
}
tasks.withType<ShadowJar> {
destinationDir = File("$rootDir/server/build")
//dependsOn(":webUI:copyBuild")
}
tasks.named("processResources") {
dependsOn(":webUI:copyBuild")
}

View File

@ -37,7 +37,12 @@ class Main {
val app = Javalin.create().start(4567)
val app = Javalin.create { config ->
// config.addSinglePageRoot("/", "")
config.addStaticFiles("/react")
}.start(4567)
app.before() { ctx ->
// allow the client which is running on another port

View File

@ -6,3 +6,16 @@ node {
workDir = file("${project.projectDir}/react/")
nodeModulesDir = file("${project.projectDir}/react/node_modules")
}
tasks.named("yarn_build") {
dependsOn("yarn_install")
}
tasks.register<Copy>("copyBuild") {
from(file("$rootDir/webUI/react/build"))
into(file("$rootDir/server/src/main/resources/react"))
}
tasks.named("copyBuild") {
dependsOn("yarn_build")
}

10
webUI/node_modules/.yarn-integrity generated vendored Normal file
View File

@ -0,0 +1,10 @@
{
"systemParams": "linux-x64-88",
"modulesFolders": [],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [],
"lockfileEntries": {},
"files": [],
"artifacts": {}
}

4
webUI/yarn.lock Normal file
View File

@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1