{"id":22707683,"url":"https://github.com/xvik/generator-lib-java","last_synced_at":"2025-08-03T20:38:06.953Z","repository":{"id":25980533,"uuid":"29422648","full_name":"xvik/generator-lib-java","owner":"xvik","description":"Yeoman generator for java library","archived":false,"fork":false,"pushed_at":"2025-02-17T04:29:55.000Z","size":1841,"stargazers_count":43,"open_issues_count":4,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T19:18:25.995Z","etag":null,"topics":["generator","java","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}},"created_at":"2015-01-18T10:40:10.000Z","updated_at":"2025-02-24T09:50:42.000Z","dependencies_parsed_at":"2024-05-02T06:43:48.676Z","dependency_job_id":null,"html_url":"https://github.com/xvik/generator-lib-java","commit_stats":{"total_commits":168,"total_committers":2,"mean_commits":84.0,"dds":0.07738095238095233,"last_synced_commit":"3574412d15e53332b001709e9907eba152e5e6e4"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-lib-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-lib-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-lib-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xvik%2Fgenerator-lib-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xvik","download_url":"https://codeload.github.com/xvik/generator-lib-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714754,"owners_count":21149961,"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","java","yeoman"],"created_at":"2024-12-10T10:13:49.327Z","updated_at":"2025-04-13T12:34:27.950Z","avatar_url":"https://github.com/xvik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java library yeoman generator\n\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/xvik/generator-lib-java)\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-lib-java.svg)](http://badge.fury.io/js/generator-lib-java)\n[![Build Status](https://travis-ci.com/xvik/generator-lib-java.svg?branch=master)](https://travis-ci.com/xvik/generator-lib-java)\n\n\n### About\n\nGenerates java library project (or multi-module library), hosted on github with maven central publication.\nIdeal for new OSS project quick start.\n\nFeatures:\n* Single and multi-module projects generation\n* [MIT](http://opensource.org/licenses/MIT) license (hardcoded)\n* [Gradle](http://www.gradle.org/) build (with support of optional and provided dependencies)\n* [Maven central](http://search.maven.org/) compatible artifacts (jar, sources, javadocs)\n* Ready for [spock](http://spockframework.org) tests ([documentation](http://docs.spockframework.org))\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* Target jdk compatibility check with [animal sniffer](http://mojo.codehaus.org/animal-sniffer/) (you may use newer jdk to build, and keep compatibility with older jdk)\n* Code quality checks ([checkstyle](http://checkstyle.sourceforge.net/), [pmd](http://pmd.sourceforge.net/), [findbugs](http://findbugs.sourceforge.net/))\n* [Release process](https://github.com/researchgate/gradle-release#introduction) (like maven release)\n\nRequires jdk8 or above (due to checkstyle [requirement](http://checkstyle.sourceforge.net/releasenotes.html#Release_7.0)). But actual library could target any java level (jdk8 is only required for build).\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### Thanks to\n\n* [Vladislav Bauer](https://github.com/vbauer) ([android-arsenal](http://android-arsenal.com/) author) for checkstyle config and [gitignore.io](https://gitignore.io) hint\n* [Juan Roperto](https://github.com/jroperto) for pmd config\n\n### Example projects\n\n#### Single module\n\n* [dropwizard-guicey](https://github.com/xvik/dropwizard-guicey)\n* [guice-validator](https://github.com/xvik/guice-validator)\n* [guice-persist-orient](https://github.com/xvik/guice-persist-orient)\n* [dropwizard-orient-server](https://github.com/xvik/dropwizard-orient-server)\n* [generics-resolver](https://github.com/xvik/generics-resolver)\n\n#### Multi-module\n\n* [guice-ext-annotations](https://github.com/xvik/guice-ext-annotations) - with published BOM\n* [yaml-config-updater](https://github.com/xvik/yaml-updater) - without BOM \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-lib-java\n```\n\n### Github setup\n\nYou will need [github](https://github.com) user. Create it if you don't have already.\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 library to local repository only\n\nIf library is assumed to be used as internal library with local (corporate) maven repo,\nmanual modifications required.\n\nRemove `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\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 published library declare custom repository in target project:\n\n```groovy\nrepositories {\n    // usually root repo combining releases and snapshots\n    maven { url 'https://my-private-nexus.com/nexus/content/groups/my/' }\n}\n```\n\n### Usage\n\n\u003e General convention: project name == github project name == bintray package page\n\nRun generator:\n\n```bash\n$ yo lib-java\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 lib-java --offline\n```\n\nProject setup ready, start coding!\n\n#### Build upgrade\n\nIf generator started in folder with already generated project - it will work in update mode.\nThis will allow you to easily update existing build with new generator version.\n\nUpdate mode skips some files to reduce update to only meaningful files (e.g. no need to update CHANGELOG.md, gradle.properties etc).\nUpdate will use previous answers by default.\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 libraries, 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-lib-java.json`\n\n### External services\n\nCreate [github](https://github.com) repo matching your library 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 badge is generated in readme.\n\n### Snapshots\n\n[JitPack](https://jitpack.io) is ideal for snapshots: it builds github project and serves dependency for you.\nSpecial section in project readme is generated to show how to use it for snapshots.\nJitPack doesn't require any configuration to support your library.\n\n### Gitter\n\n[Gitter](https://gitter.im) is a chat room for your repository. Most likely, with it you\nwill get much more feedback (something people will never post as issue or write by email).\n\nGitter badge is not generated automatically, because it's not required as other services and it's too easy to add at any time.\nLook it and decide if you need it.\n\n### Documentation\n\nYou can use [gradle-mkdocs-plugin](https://github.com/xvik/gradle-mkdocs-plugin) for writing versioned project documentation\n(published on github pages).\n\n### Project usage\n\n```bash\n$ gradlew check\n```\n\nRuns code quality plugins and tests. 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 library to local maven repository. Useful for referencing by other projects (for testing without releasing library).\n\n```bash\n$ gradlew release\n```\n\nReleases library. Read release process section below before performing first release.\n\n### Project details\n\nUsed gradle plugins:\n* [java](http://www.gradle.org/docs/current/userguide/java_plugin.html)\n* [groovy](http://www.gradle.org/docs/current/userguide/groovy_plugin.html) to support spock tests\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* [jacoco](http://www.gradle.org/docs/current/userguide/jacoco_plugin.html) to build coverage report for coveralls\n* [pmd](http://www.gradle.org/docs/current/userguide/pmd_plugin.html) to check code quality with [PMD](http://pmd.sourceforge.net/) tool\n* [checkstyle](http://www.gradle.org/docs/current/userguide/checkstyle_plugin.html) to check code style rules with [checkstyle](http://checkstyle.sourceforge.net/index.html)\n* [spotbugs](https://github.com/spotbugs/spotbugs-gradle-plugin) to find potential bugs with [spotbugs](https://spotbugs.github.io/)\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 quality plugins and provide advanced reporting\n\n#### Optional dependencies\n\nOptional and provided dependencies support provided by [ru.vyarus.pom plugin](https://github.com/xvik/gradle-pom-plugin).\n\nExample usage:\n\n```groovy\nprovided 'com.github.spotbugs:spotbugs-annotations:3.1.2'\n```\n\nor\n\n```groovy\noptional 'com.github.spotbugs:spotbugs-annotations:3.1.2'\n```\n\nIn the generated pom these dependencies will be defined as provided or optional, but for gradle build it's\nthe same as declaring them in `implementation` scope.\n\njsr305 provided dependency is defined by default in generated project (useful to guide firebug). \n\nScala note: The Scala compiler, unlike the Java compiler, [requires that annotations used by a library be available when\ncompiling against that library](https://issues.scala-lang.org/browse/SI-5420).\nIf your library users will compile with Scala, they must declare a dependency on JSR-305 jar.\n\n### Quality tools\n\nQuality tools are configured by [ru.vyarus.quality plugin](https://github.com/xvik/gradle-quality-plugin).\n\nRead more about quality tools specifics and how to suppress warnings:\n* [checkstyle](http://xvik.github.io/gradle-quality-plugin/3.0.0/tool/checkstyle/)\n* [pmd](http://xvik.github.io/gradle-quality-plugin/3.0.0/tool/pmd/)\n* [spotbugs](http://xvik.github.io/gradle-quality-plugin/3.0.0/tool/spotbugs/)\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### 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\n### Support\n\n[Gitter chat room](https://gitter.im/xvik/generator-lib-java)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxvik%2Fgenerator-lib-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxvik%2Fgenerator-lib-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxvik%2Fgenerator-lib-java/lists"}