diff --git a/.gitignore b/.gitignore index 7915a313bfbe9afacbc3ea22dfcecc2b85c28745..095be6362be29551d2b5c8a78daff21af8de4272 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +.idea +*.iml node_modules compile_flags.txt diff --git a/slides/pages/recap.md b/slides/pages/recap.md index 34df5da6bb393d2c871417d452d04fba015b684f..a540f42d556f343bc3a04ac6ccc240456c9bef96 100644 --- a/slides/pages/recap.md +++ b/slides/pages/recap.md @@ -65,10 +65,54 @@ title: Java Dev Environment Setup layout: center --- -### Java Dev Environment Setup +# Java Dev Environment Setup <br/> - Using an IDE is recommended: [IntelliJ IDEA](https://www.jetbrains.com/idea/download/), [Eclipse](https://www.eclipse.org/downloads/) - Install JDK: [Oracle JDK 17](https://docs.oracle.com/en/java/javase/17/install/overview-jdk-installation.html#GUID-8677A77F-231A-40F7-98B9-1FD0B48C346A) (same version on Andorra) - Use [Gradle](https://gradle.org/) for building and running your project, or use the IDE's built-in tools +- Use [Package Search](https://package-search.jetbrains.com/) to find your java libraries + + +--- +title: Gradle I +--- + +# Gradle + +- Gradle is an open-source build automation tool focused on flexibility and performance. +- Gradle build scripts are written using a **Groovy** or **Kotlin** DSL. +- Check out the [Installation Guide](https://docs.gradle.org/current/userguide/installation.html) +- `build.gradle/build.gradle.kts` is the main configuration file for a Gradle project +- `gradlew` is the Gradle wrapper script, which is used to execute Gradle tasks for Linux or MacOS +- `gradlew.bat` is the Gradle wrapper script for Windows + +--- +title: Gradle II +--- + +## Write a Task in Gradle Build Script + +Write a task in gradle build script to run java program. + +```kotlin +tasks.register<JavaExec>("<task-name>") { + // if your program needs input from stdin + standardInput = System.`in` + + // Set the main class to be executed + mainClass.set("<main-class>") + + // Set classpath dependencies if needed + classpath = sourceSets.main.get().runtimeClasspath + + // Set JVM arguments if needed + // jvmArgs = listOf("-Xmx512m") + + // Set program arguments if needed + // args = listOf("arg1", "arg2") +} +``` + +See live demo in the tutorial.