{"id":18715022,"url":"https://github.com/griffio/exercises_build_convention","last_synced_at":"2026-05-05T02:39:56.023Z","repository":{"id":221032093,"uuid":"753063053","full_name":"griffio/exercises_build_convention","owner":"griffio","description":"gradle build conventions with composite build","archived":false,"fork":false,"pushed_at":"2024-02-11T12:33:54.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-19T11:45:49.434Z","etag":null,"topics":["composite","conventions","gradle","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/griffio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-05T11:54:01.000Z","updated_at":"2024-02-11T13:14:42.000Z","dependencies_parsed_at":"2024-02-11T13:35:57.131Z","dependency_job_id":null,"html_url":"https://github.com/griffio/exercises_build_convention","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"3673817861b4a64feb20d0e189bd75e00491d8fa"},"previous_names":["griffio/exercises_build_convention"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/griffio/exercises_build_convention","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffio%2Fexercises_build_convention","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffio%2Fexercises_build_convention/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffio%2Fexercises_build_convention/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffio%2Fexercises_build_convention/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/griffio","download_url":"https://codeload.github.com/griffio/exercises_build_convention/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffio%2Fexercises_build_convention/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32633438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composite","conventions","gradle","kotlin"],"created_at":"2024-11-07T13:07:17.814Z","updated_at":"2026-05-05T02:39:55.996Z","avatar_url":"https://github.com/griffio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Exercises Build Convention\n\nExercise projects share the same build config, this is located in `gradle\\build-conventions` sub-project.\n\nThis is to be opened in Intellij at the root of the repo - with each exercise runnable in self-contained build.\nThere is no top level build file - instead each exercise project has its own build file, there is composite build for conventions.\nbased on `https://docs.gradle.org/current/samples/sample_sharing_convention_plugins_with_build_logic.html`\n\nThe `gradle/build-conventions` (moved to gradle folder to keep top-level tidy) wraps the build configuration as a plugin `griffio.exercise-conventions` to be used in the exercise projects,\nthis `includeBuild` works effectively the same as using a top-level gradle `buildSrc` that can be named and located elsewhere.\n\nNew exercise directories, where adding the build.gradle.kts, can be included in `settings.gradle.kts` for the build to run.\n\nRequires JAVA_HOME for JDK 17 installed - gradle.properties and settings.gradle.kts disables plugin `org.gradle.toolchains.foojay-resolver-convention` to automatically download jdks.\n\n### Conventions \n\nFlatten `src/main/kotlin`, `src/main/java`  to `src`, allow mix of Kotlin and Java sources, set the Main class, use a JDK 17 toolchain.\n\n```\nplugins {\n    application\n    kotlin(\"jvm\")\n}\n\ngroup = \"exercises\"\nversion = \"1.0-SNAPSHOT\"\n\nrepositories {\n    mavenCentral()\n}\n\nsourceSets.main { // override the nested layout\n    kotlin.srcDirs(\"src\")\n    java.srcDirs(\"src\")\n}\n\ndependencies {\n}\n\napplication {\n    mainClass = \"MainKt\"\n}\n\nkotlin {\n    jvmToolchain(17) // could be any other JDK \n}\n```\n\nRun all exercises from the top-level directory\n\n```\n./gradlew run\n```\n\nor each exercise project individually\n\n```\n./gradlew :exercises:some_training_module:exercise_1:run\n```\n\nsame path abbreviated\n\n```\n./gradlew e:s:ex_1:run\n```\n\nExecute Gradle wrapper relatively from within exercise project\n\n```\ncd exercises_build_convention/exercises/some_training_module/exercise_2\n\n../../../gradlew run\n```\n\nRun a task continuously, this will wait for changes to the source code and re-run saving startup time\n\n```\n./gradlew e:s:exercise_1:run --continuous\n```\n\nCreate an alias to the exercise project `run` task relative to the repo\n\n```\nalias run_ex='$(git rev-parse --show-toplevel)/gradlew run --continuous'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgriffio%2Fexercises_build_convention","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgriffio%2Fexercises_build_convention","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgriffio%2Fexercises_build_convention/lists"}