gotoOla
01/14/2019, 8:09 AMNikky
01/14/2019, 11:35 PMJavaExec
task available without the application plugin and you will have to deal with setting up the arguments and possibly classpath as well.. depending on the complexity of your projectgildor
01/15/2019, 12:59 AMDALDEI
01/15/2019, 6:42 AMgildor
01/15/2019, 6:53 AMgotoOla
01/15/2019, 2:21 PMtask run(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = mainClassName
}
gildor
01/15/2019, 2:40 PMgotoOla
01/15/2019, 4:33 PM./gradlew build -m
:discoverMainScriptsExtensions SKIPPED
:compileKotlin SKIPPED
:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:inspectClassesForKotlinIC SKIPPED
:jar SKIPPED
:assemble SKIPPED
:discoverTestScriptsExtensions SKIPPED
:compileTestKotlin SKIPPED
:compileTestJava SKIPPED
:processTestResources SKIPPED
:testClasses SKIPPED
:test SKIPPED
:check SKIPPED
:shadowJar SKIPPED
:build SKIPPED
whilest with the application plugin I see shadowDistZip and all of the distribution tasks (distZip, distTar etc)apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
apply plugin: 'kotlin'
tasks.build.dependsOn tasks.shadowJar
gildor
01/15/2019, 4:39 PMgotoOla
01/15/2019, 4:42 PMADD ./build/libs/app.jar app.jar
or would I miss out on anything from the application plugin by doing this?gildor
01/15/2019, 4:48 PMbuild
already depends on jar
task, if you don't need common (non fat) jar, just disable this taskall
, but this is configurable)java -jar your-app.jar
gotoOla
01/15/2019, 5:18 PMapply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
apply plugin: 'kotlin'
tasks.build.dependsOn tasks.shadowJar
def appName="app"
mainClassName="my.example.AppKt"
shadowJar {
baseName = appName
classifier = null
version = null
manifest {
attributes 'Main-Class': mainClassName
}
}
becuase with this I am able to do java -jar
on the produced “app.jar”