gotoOla
01/14/2019, 8:09 AMNikky
01/14/2019, 11:35 PMNikky
01/14/2019, 11:37 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 PMgotoOla
01/15/2019, 2:22 PMgotoOla
01/15/2019, 2:25 PMtask run(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = mainClassName
}gildor
01/15/2019, 2:40 PMgildor
01/15/2019, 2:41 PMgotoOla
01/15/2019, 4:33 PMgotoOla
01/15/2019, 4:35 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)gotoOla
01/15/2019, 4:36 PMapply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
apply plugin: 'kotlin'
tasks.build.dependsOn tasks.shadowJargildor
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?gotoOla
01/15/2019, 4:47 PMgildor
01/15/2019, 4:48 PMgildor
01/15/2019, 4:49 PMgildor
01/15/2019, 4:50 PMbuild already depends on jar task, if you don't need common (non fat) jar, just disable this taskgildor
01/15/2019, 4:51 PMall, but this is configurable)gildor
01/15/2019, 4:53 PMjava -jar your-app.jargildor
01/15/2019, 4:53 PMgotoOla
01/15/2019, 5:18 PMgotoOla
01/15/2019, 5:19 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āgotoOla
01/15/2019, 5:19 PM