{"id":22707680,"url":"https://github.com/xvik/generator-gradle-plugin","last_synced_at":"2025-07-16T19:32:24.159Z","repository":{"id":3351804,"uuid":"49170933","full_name":"xvik/generator-gradle-plugin","owner":"xvik","description":"Yeoman generator for gradle plugin","archived":false,"fork":false,"pushed_at":"2025-02-17T04:29:43.000Z","size":1715,"stargazers_count":12,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-14T08:18:38.606Z","etag":null,"topics":["generator","gradle","gradle-plugin","yeoman"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xvik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2016-01-07T00:44:08.000Z","updated_at":"2025-02-24T09:50:41.000Z","dependencies_parsed_at":"2024-05-02T06:43:57.623Z","dependency_job_id":"48ffcd68-9a94-412e-be1b-80d5c1ff2eab","html_url":"https://github.com/xvik/generator-gradle-plugin","commit_stats":{"total_commits":137,"total_committers":2,"mean_commits":68.5,"dds":0.0948905109489051,"last_synced_commit":"abdd5a48b3c7da4a53977f79c1fbbc267b3f81fa"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/xvik/generator-gradle-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xvik","download_url":"https://codeload.github.com/xvik/generator-gradle-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-gradle-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265502129,"owners_count":23777764,"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":["generator","gradle","gradle-plugin","yeoman"],"created_at":"2024-12-10T10:13:47.858Z","updated_at":"2025-07-16T19:32:24.112Z","avatar_url":"https://github.com/xvik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gradle plugin yeoman generator\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://www.opensource.org/licenses/MIT)\n[![NPM version](https://img.shields.io/npm/v/generator-gradle-plugin.svg)](http://badge.fury.io/js/generator-gradle-plugin)\n[![Build Status](https://travis-ci.com/xvik/generator-gradle-plugin.svg?branch=master)](https://travis-ci.com/xvik/generator-gradle-plugin)\n\n### About\n\nGenerates gradle plugin project configured to publish to plugins portal and (optionally) to jcenter (and maven central).\nProject assumes hosting on github.\n\nFeatures:\n* [MIT](http://opensource.org/licenses/MIT) license (hardcoded)\n* Plugin sample\n* Tests samples with ProjectBuilder and TestKit\n* Configured for publishing to plugins portal and maven central\n* CI: github actions (linux), [appveyor](https://www.appveyor.com/) (windows)\n* Coverage with jacoco, merged from both win and linux builds in [codecov.io](https://codecov.io/)\n* Code quality checks with CodeNarc\n* [Release process](https://github.com/researchgate/gradle-release#introduction) (like maven release)\n\nNote: gradle 6.9 used instead of 7.x because groovy plugin compiled under 7.x would not be compatible\nwith the previous gradle versions (plugin would be usable only with gradle 7.x, which is not desired)\n\n### Known issue\n\nGradle 2.13+ has a [bug with console input](https://issues.gradle.org/browse/GRADLE-3446). As a result, \nduring release version confirm questions are [not visible](https://github.com/researchgate/gradle-release/issues/185).\n\nIssue is not blocking and only affects release process: simply hit enter for questions (and be sure version in properties file is correct). \n\n### Example projects\n\n* [gradle-quality-plugin](https://github.com/xvik/gradle-quality-plugin)\n* [gradle-mkdocs-plugin](https://github.com/xvik/gradle-mkdocs-plugin)\n* [gradle-use-python-plugin](https://github.com/xvik/gradle-use-python-plugin)\n* [gradle-pom-plugin](https://github.com/xvik/gradle-pom-plugin)\n* [gradle-java-lib-plugin](https://github.com/xvik/gradle-java-lib-plugin)\n* [gradle-github-info-plugin](https://github.com/xvik/gradle-github-info-plugin)\n* [gradle-animalsniffer-plugin](https://github.com/xvik/gradle-animalsniffer-plugin)\n\n### Important\n\nGradle propose publishing plugins to [plugins portal](https://plugins.gradle.org),\nbut some users prefer using plugins only from maven central (for security reasons), so it\nis a good idea to publish into both.\n  \nBy default, when plugin published to plugins portal, its group is prefixed with 'gradle.plugin' (so if your group was 'com.foo', \nreal artifact group will be 'gradle.plugin.com.foo'). Such default behaviour grants immediate plugin publishing.\nIf you want to mirror plugin on maven central it's better to force your group name. In this case plugin will require manual approve\nbefore it appears on portal (it should be approved within 1 day, but in my case it was two weeks). After approve you can\npublish new plugins with the same group without approve (the same as in maven central).\n\nGenerator supports all possible options (based on your answers):\n* publish to plugins portal only with default group (portal will prepend 'gradle.plugin' to your group)\n* publish to plugins portal only with forced group (requires approve)\n* publish to plugins portal with forced group and to jcenter (optionally to maven central) \n\nNote: plugin-publish plugin use its own tasks to prepare published artifacts. In order to upload to maven central\nproject will use different tasks (defined by java-lib plugin). So artifacts published to plugin portal and maven central \nwill be different (jars content will be almost identical, but they will be build by different tasks).\n\nNOTE: you can also publish plugins into local repository (e.g. internal nexus), but \nyou'll have to manually modify generated project (generate with maven central publication) - read below.\n\n### Setup\n\nInstall [yeoman](http://yeoman.io/):\n\n```bash\n$ npm install -g yo\n```\n\nInstall generator:\n\n```bash\n$ npm install -g generator-gradle-plugin\n```\n\n### Github setup\n\nYou will need [github](https://github.com) user. Create it if you don't have already.\n\n### Gradle user\n\nYou will need [gradle user](https://login.gradle.org/user/login) to upload to plugins portal.\n\nIn your profile page go to API keys tab and generate api key.\nAdd key and secret to `~/.gradle/gradle.properties`\n\n```\ngradle.publish.key=\ngradle.publish.secret=\n```\n\n### Maven central setup\n\nFor maven central publication you must first register in sonatype and approve your group.\nRead this a bit [outdated article](https://medium.com/@vyarus/the-hard-way-to-maven-central-c9e16d163acc)\nfor getting started.\n\nFor certificate generation see [java-lib plugin docs](https://github.com/xvik/gradle-java-lib-plugin#signing)\nNote that signing configuration required only for release (otherwise its ignored)\n\nAfter all you'll need to put the following properties into `~/.gradle/gradle.properties`\n\n```\nsonatypeUser =\nsonatypePassword =\n\nsigning.keyId = 78065050\nsigning.password =\nsigning.secretKeyRingFile = /path/to/certs.gpg\n```\n\nGenerator will check and warn you if something is not configured.\n\n### Publishing plugin to local repository only\n\nIf plugin is assumed to be used as internal plugin with local (corporate) maven repo, manual modifications required. \n\nGenerate project for maven central publication.\n\nRemove `com.gradle.plugin-publish` (no need to publish to portal) and `io.github.gradle-nexus.publish-plugin`.\n\nRemove `ru.vyarus.github-info` (I assume your source would not be in github). And remove related\n`github` configuration block. \n\nRemove `signing` plugin if you don't need to sign artifacts for your repository.\n\nConfigure repository:\n\n```groovy\npublishing {\n    repositories {\n        maven {\n            url project.version.contains(\"SNAPSHOT\")\n                    ? \"https://my-private-nexus.com/nexus/content/repositories/my-snapshots\"\n                    : \"https://my-private-nexus.com/nexus/content/repositories/my-releases\"\n            credentials {\n                username = project.findProperty('myRepoUser')\n                password = project.findProperty('myRepoPass')\n            }\n        }\n    }\n}\n```\n\nDisable gradle-plugin publication (normally used for portal publication):\n\n```groovy\ntasks.withType(AbstractPublishToMaven) { Task task -\u003e\n    if (task.name.startsWith(\"publishPluginMaven\")) {\n        task.enabled(false)\n    }\n}\n```\n\nNOTE: there is still an additional publication used: gradle would publish \n[marker artifact](https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers) required for plugins syntax.\n\nChange releasing task:\n\n```groovy\nafterReleaseBuild {\n    dependsOn = [publish]\n```\n\nNow simple `publish` task deploys snapshot version and `release` task would perform complete release\n(with version change and tagging git).\n\nTo use plugins from custom repo add to settings.gradle (in project requiring published plugin):\n\n```groovy\npluginManagement {\n    repositories {\n        maven {\n            // usually root repo combining releases and snapshots\n            url 'https://my-private-nexus.com/nexus/content/groups/my/'\n        }\n        gradlePluginPortal()\n    }\n}\n```\n\nWith it plugin from custom repo could be enabled in `plugins` section the same way as plugin\nfrom gradle portal (thanks to additionally published marker artifact).\n\n### Usage\n\n\u003e General convention: project name == github project name\n\nRun generator:\n\n```bash\n$ yo gradle-plugin\n```\n\nGenerator creates project in current folder if project name (question) is the same as current directory,\nand will create subdirectory otherwise.\n\nGenerator calls github to validate user correctness and suggest your name and email. If there is a problem with it use offline mode:\n\n```bash\n$ yo gradle-plugin --offline\n```\n\nProject setup ready, start coding!\n\n#### Build upgrade\n\nIf you preserve `.yo-rc.json` file (your answers) in generated project root you will be able to use update mode.\n\nRun generator project directory:\n\n```bash\n$ cd my-project\n$ yo gradle-plugin \n```\n\nGenerator will work in update mode: it will use answers stored in .yo-rc.json and re-generate project files.\nIt will not generate sample sources again and also will not touch: CHANGELOG.md, README.md, gradle.properties, LICENSE and settings.gradle.\n\nIt updates:\n* Project gradle (wrapper files, scripts and version in build.gradle)\n* Gradle configs: build.gradle, settings.gradle\n* gitignore\n\nThis mode is useful when project isn't changed much after generation. In case when you have multiple projects \nit greatly simplifies projects upgrade: doing all changes manually could lead to forgotten changes, \nbut with generator its impossible to forget something because all changes are always done.\n\nStart update without local changes and after generation look git changes and correct\n(usually only main build.gradle requires modifications after update).\n\n#### Global storage\n\nMost likely, some answers will be the same for all your plugins, that's why they are stored in global config and\nyou will see more precise defaults on next generation.\n\nGlobal config stored in `~/.config/configstore/generator-gradle-plugin.json`\n\n### External services\n\nCreate [github](https://github.com) repo matching your plugin name and push project there (github will guide you).\n\nIn github project settings go to `Webhooks \u0026 services` and add `travis-ci` service.\n\nEnable repository on [appveyor](https://www.appveyor.com/) \n\nAnd after next commit windows and linux builds will be performed automatically and combined coverage report\nwill be available on [codecov](https://codecov.io/) (badges for all services are already generated in readme). \n\nMaven central and gradle portal badges are generated in readme.\n\n### Project usage\n\n```bash\n$ gradlew check\n```\n\nRuns code quality plugins. If quality checks were activated (asked during generation) do check before pushing to avoid\nbuild failures on travis. Moreover, it's easy to always keep everything clean instead of doing it before release.\n\n```bash\n$ gradlew dependencyUpdates\n```\n\nChecks if your project dependencies are actual and prints versions analysis report to console.\n\n```bash\n$ gradlew dependencies\n```\n\nPrints dependencies tree into console\n\n```bash\n$ gradlew openDependencyReport\n```\n\nGenerates dependencies html report and launch it in default browser.\nTo analyze conflicts, click on dependency name to activate\n[dependencyInsight](http://www.gradle.org/docs/current/groovydoc/org/gradle/api/tasks/diagnostics/DependencyInsightReportTask.html) popup.\n\n```bash\n$ gradlew install\n```\n\nInstalls plugin to local maven repository. Useful for referencing by other projects (for testing without releasing plugin).\n\nNOTE: gradle will complain about multiple publications with the same coordinates - that's fine\n(install publish all publications - one prepared for central and another used by gradle portal publication)\n\nFor example, to use not released but installed to local maven in gradle project:\n\n```groovy\nbuildscript {\n    repositories { mavenLocal() }\n    classpath 'group:artifact:version-SNAPSHOT'\n}\napply plugin: 'my.plugin'\n```\n\n(or just puty snapshot version in plugins section if settings.gradle contains mavenLocal for plugins resolution)\n\n```bash\n$ gradlew release\n```\n\nReleases plugin. Read release process section below before performing first release.\n\n### Project details\n\nNote that gradle api dependencies are not specified directly, but project will implicitly have \n`localGroovy()`, `gradleApi()` and `gradleTestKit()` dependencies applied by [java-gradle-plugin](https://docs.gradle.org/current/userguide/javaGradle_plugin.html)\n\nUsed gradle plugins:\n* [groovy](http://www.gradle.org/docs/current/userguide/groovy_plugin.html) as main used language\n* [jacoco](https://docs.gradle.org/current/userguide/jacoco_plugin.html) for coverage recording\n* [java-gradle-plugin](https://docs.gradle.org/current/userguide/javaGradle_plugin.html) assist plugin development\n* [com.gradle.plugin-publish](https://plugins.gradle.org/docs/publish-plugin) to publish to gradle plugins portal\n* [maven-publish](http://www.gradle.org/docs/current/userguide/publishing_maven.html) to generate pom and publish to maven repository\n* [project-report](http://www.gradle.org/docs/current/userguide/project_reports_plugin.html) to generate dependency tree html report\n* [codenarc](https://docs.gradle.org/current/userguide/codenarc_plugin.html) to check quality with [CodeNarc](http://codenarc.sourceforge.net/index.html)\n* [o.github.gradle-nexus.publish-plugin](https://github.com/gradle-nexus/publish-plugin) to simplify maven central publication\n* [com.github.ben-manes.versions](https://github.com/ben-manes/gradle-versions-plugin) to check dependencies versions updates\n* [net.researchgate.release](https://github.com/researchgate/gradle-release) for release (see [article](http://www.sosaywecode.com/gradle-release-plugin/) for additional plugin details)\n* [ru.vyarus.pom](https://github.com/xvik/gradle-pom-plugin) for simpler pom generation\n* [ru.vyarus.java-lib](https://github.com/xvik/gradle-java-lib-plugin) to prepare java artifacts setup\n* [ru.vyarus.github-info](https://github.com/xvik/gradle-github-info-plugin) to fill in github specific data\n* [ru.vyarus.quality](https://github.com/xvik/gradle-quality-plugin) to configure codenarc plugin and provide advanced reporting\n* [pl.droidsonroids.jacoco.testkit](https://github.com/koral--/jacoco-gradle-testkit-plugin) to spport coverage recordings in testkit based tests\n\n### Quality\n\nCodeNarc quality plugin is configured by [ru.vyarus.quality plugin](https://github.com/xvik/gradle-quality-plugin).\n\nRead more about [plugin specifics and how to suppress warnings](http://xvik.github.io/gradle-quality-plugin/3.0.0/tool/codenarc/)\n\nBy default, quality checks fail build if any violation found. In order to simply report violations do:\n\n```groovy\nquality {\n    strict = false\n}\n```\n\n### Testing\n\nGenerator will genarate sample plugin and two types of tests:\n* With [ProjectBuilder](https://docs.gradle.org/current/javadoc/org/gradle/testfixtures/ProjectBuilder.html)\n* Using [TestKit](https://docs.gradle.org/current/userguide/test_kit.html)\n\nProject build tests are good for checking configuration. They run in the same vm and so they are fast.\n\nTestKit tests are useful to validate tasks execution (especially if there are files operations involved). These tests use \nreal gradle build run. TestKit tests may be launched even for [different gradle versions](https://docs.gradle.org/current/javadoc/org/gradle/testkit/runner/GradleRunner.html#withGradleVersion(java.lang.String)).\n\nFor more tests examples see [my plugins](#example-projects) sources. \n\nNOTE: if tests failed to run in your IDE, then run tests from gradle first (tests task). Gradle generates classpath file before running TestKit tests \n(tests can't work without this file). When tests run from IDE, file generation is not triggered automatically, so have to keep in mind this workaround.\n\n### Release process\n\n#### Before first release\n\nWhen releasing first time it's better to do\n\n```bash\n$ gradlew install\n```\n\nAnd validate generated pom file and jars (in local maven repository ~/.m2/repository/..).\n\n#### General release process\n\nUpdate `CHANGELOG.md`.\n\nPush all changes before release and wait for `travis` to check build (wait for green badge).\n\nPerform release:\n\n```bash\n$ gradlew release\n```\n\nRelease will check that current copy is actual: no uncommitted/unversioned/unpushed changes, nothing newer is in remote repository.\nYou can start releasing either from snapshot version (1.0.0-SNAPSHOT) or from normal one (1.0.0).\n\nDuring release, plugin will create tag (new github release appear) and update version in `gradle.properties`.\n\nYou may want to create github release: release will only create tag. To create release go to github releases, click on tag and press 'edit'.\nI usually use text from changelog as release message, but you may expand it with other release specific notes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxvik%2Fgenerator-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxvik%2Fgenerator-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxvik%2Fgenerator-gradle-plugin/lists"}