JAVA-11495 Moved gradle modules to gradle-modules

This commit is contained in:
Dhawal Kapil
2022-07-09 20:10:23 +05:30
parent 103a374ba1
commit 84c06c772b
160 changed files with 6 additions and 13 deletions
@@ -0,0 +1 @@
/build/
@@ -0,0 +1,47 @@
apply plugin: "application"
description = "Java MainClass execution examples"
ext {
javaMainClass = "com.baeldung.gradle.exec.MainClass"
}
jar {
manifest {
attributes(
"Main-Class": javaMainClass
)
}
}
application {
mainClassName = javaMainClass
}
task runWithJavaExec(type: JavaExec) {
group = "Execution"
description = "Run the main class with JavaExecTask"
classpath = sourceSets.main.runtimeClasspath
main = javaMainClass
}
task runWithExec(type: Exec) {
dependsOn build
group = "Execution"
description = "Run the main class with ExecTask"
commandLine "java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(), javaMainClass
}
task runWithExecJarExecutable(type: Exec) {
dependsOn jar
group = "Execution"
description = "Run the output executable jar with ExecTask"
commandLine "java", "-jar", jar.archiveFile.get()
}
task runWithExecJarOnClassPath(type: Exec) {
dependsOn jar
group = "Execution"
description = "Run the mainClass from the output jar in classpath with ExecTask"
commandLine "java", "-classpath", jar.archiveFile.get() , javaMainClass
}
@@ -0,0 +1,8 @@
package com.baeldung.gradle.exec;
public class MainClass {
public static void main(String[] args) {
System.out.println("Goodbye cruel world ...");
}
}