{"id":18058850,"url":"https://github.com/phpirates/kotlin-template-project","last_synced_at":"2025-04-11T08:33:13.407Z","repository":{"id":39459953,"uuid":"124569996","full_name":"PHPirates/kotlin-template-project","owner":"PHPirates","description":"Showcase of simple tests in Kotlin using JUnit 5, Spek 2 and using Kotlin Script Gradle","archived":false,"fork":false,"pushed_at":"2023-05-05T17:53:22.000Z","size":494,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T06:03:37.890Z","etag":null,"topics":["gradle","junit5","kotlin","kotlin-dsl","kotlin-testing","spek"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PHPirates.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-09T17:07:19.000Z","updated_at":"2023-12-22T11:04:46.000Z","dependencies_parsed_at":"2022-09-05T02:41:08.201Z","dependency_job_id":null,"html_url":"https://github.com/PHPirates/kotlin-template-project","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPirates%2Fkotlin-template-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPirates%2Fkotlin-template-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPirates%2Fkotlin-template-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPirates%2Fkotlin-template-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHPirates","download_url":"https://codeload.github.com/PHPirates/kotlin-template-project/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248361567,"owners_count":21090932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["gradle","junit5","kotlin","kotlin-dsl","kotlin-testing","spek"],"created_at":"2024-10-31T03:09:36.974Z","updated_at":"2025-04-11T08:33:13.377Z","avatar_url":"https://github.com/PHPirates.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":". | .\n --- | ---\nGitHub Actions | ![GitHub Workflow Status](https://github.com/PHPirates/kotlin-template-project/workflows/CI/badge.svg)\nTravis | [![Build Status](https://travis-ci.org/PHPirates/kotlin-template-project.svg?branch=master)](https://travis-ci.org/PHPirates/kotlin-template-project)\nCoveralls | [![Coverage Status](https://coveralls.io/repos/github/PHPirates/kotlin-template-project/badge.svg?branch=master)](https://coveralls.io/github/PHPirates/kotlin-template-project?branch=master)\nCodecov | [![codecov](https://codecov.io/gh/PHPirates/kotlin-template-project/branch/master/graph/badge.svg)](https://codecov.io/gh/PHPirates/kotlin-template-project)\n\n# Template project which contains minimal examples of using Gradle\n\n\u003e Note that both a Gradle (build.gradle) and a Gradle Kotlin DSL (build.gradle.kts) build file are present.\n\nThis project aims to provide an example of the use of the Gradle Kotlin DSL with some testing frameworks and libraries, since the official documentation is at the moment of writing very minimal.\nThere are both a Groovy Gradle ([`build.gradle`](build.gradle.inactive), not updated recently) and a Kotlin Script Gradle ([`build.gradle.kts`](build.gradle.kts) updated recently) build file present which do roughly the same, which may make translation a bit easier.\nFor other translation examples, see [below](#translations).\n\nThis is the Kotlin equivalent of this (older) [java template project](https://github.com/PHPirates/java-template-project).\n\nIt makes use of\n* Kotlin\n* Kotlin Script Gradle or Gradle Kotlin DSL \n* A normal, Groovy Gradle build file is also present\n* JaCoCo for generating test reports\n* Codecov.io which takes the JaCoCo report and shows some statistics\n* Coveralls.io coverage reports uploaded by the coveralls-jacoco plugin (https://github.com/nbaztec/coveralls-jacoco-gradle-plugin)\n\nThere are tests using\n* kotlintest (will be run by Gradle since kotlintest 3)\n* JUnit 5\n* Spek 2\n\n## How to add Gradle to your existing project\n\nDecide whether you want to use Groovy Gradle (older and widely used) or the Gradle Kotlin DSL (newer and starting to be used more and more).\n\n* Copy the `build.gradle.kts` and `settings.gradle.kts` (Gradle Kotlin DSL, as you can see from the `.kts` extension) or the `build.gradle` (Groovy Gradle, it this repo it may be named `build.gradle.inactive` but just rename it to `build.gradle`)\n* Read through the file you just copied and change the relevant names, remove things of which you are sure you don't need them\n* Copy the `gradlew`, `gradlew.bat` and `gradle/` files and folder.\n* Go to File | New | Module from Existing Sources and select your `build.gradle` file. Make sure 'Use gradle wrapper' is selected. Select a different Gradle JVM if prompted.\n* You should commit all the files you added, but not the generated files in `.gradle/`.\n* You can run Gradle tasks from the Gradle window on the right, for example `build` to build your project, `run` to run the main class if you have one or `check` to run tests.\n* It is recommended that you use a continuous integration service like Travis, which will build and run tests on their server when you push a commit. Install the Travis GitHub App by going to the GitHub marketplace, and after that copy the `.travis.yml`, possibly remove parts you don't need.\n\n## Tips\nThis was only tested with IntelliJ.\n\n* You can quickly import the project into IntelliJ by importing the `build.gradle.kts` file. Select the Gradle wrapper if needed.\n\n* To run Gradle tasks, e.g. to run all tests (the verification/check task) or to start the main class (application/run) open the Gradle toolbar on the right and double-click (or right-click and debug) the task.\n\n* Alternatively, without IntelliJ, you can run `gradlew test` on the terminal to run the tests via gradle with the gradle wrapper (so you don't have to first install gradle locally by hand).\n\n* If you see all gradle keywords greyed out you may want to link the Gradle project in IntelliJ, if you do not see a popup asking you to do so then go to modules - import module and select your `build.gradle.kts`.\n\nFeel free to use GitHub emojis as for example by [François Parmentier](https://gist.github.com/parmentf/035de27d6ed1dce0b36a).\n\n## \u003ca name=\"translations\"\u003eSome example translations from Groovy Gradle to Kotlin Script Gradle\u003c/a\u003e\n\n### Task configuration\n\nGroovy Gradle:\n```\n// This is a configuration for the shadowJar task.\nshadowJar{\n  classifier = 'deploy'\n}\n```\n\nKotlin Script Gradle:\n```\nimport com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar\n\ntasks {\n    // This is a configuration for the shadowJar task.\n    \"shadowJar\"(ShadowJar::class) {\n        classifier = \"deploy\"\n    }\n}\n```\n\n## Corresponding SO questions\n[Run JUnit 5 with Gradle](https://stackoverflow.com/questions/44429751/how-to-use-junit-5-with-gradle)\n\n[Run kotlintest and JUnit 5 tests with Gradle](https://stackoverflow.com/questions/49638462/how-to-run-kotlintest-tests-using-the-gradle-kotlin-dsl)\n\n[Upload test reports of Kotlin sources to Coveralls](https://stackoverflow.com/questions/50903389/how-to-upload-test-reports-of-kotlin-sources-to-coveralls)\n\n[The DefaultSourceDirectorySet constructor has been deprecated. How to use the ObjectFactory service?](https://stackoverflow.com/questions/53461821/the-defaultsourcedirectoryset-constructor-has-been-deprecated-how-to-use-the-ob)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpirates%2Fkotlin-template-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpirates%2Fkotlin-template-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpirates%2Fkotlin-template-project/lists"}