{"id":21513243,"url":"https://github.com/patrickfav/mvn-common-parent","last_synced_at":"2025-04-09T18:53:04.874Z","repository":{"id":56043237,"uuid":"175984471","full_name":"patrickfav/mvn-common-parent","owner":"patrickfav","description":"A maven configuration which can be used as a commons config parent for POM files","archived":false,"fork":false,"pushed_at":"2023-08-07T09:51:38.000Z","size":401,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T20:51:16.492Z","etag":null,"topics":["common","maven","maven-parent"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrickfav.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","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":"2019-03-16T14:46:01.000Z","updated_at":"2024-12-09T19:53:51.000Z","dependencies_parsed_at":"2022-08-15T12:01:04.374Z","dependency_job_id":null,"html_url":"https://github.com/patrickfav/mvn-common-parent","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickfav%2Fmvn-common-parent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickfav%2Fmvn-common-parent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickfav%2Fmvn-common-parent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickfav%2Fmvn-common-parent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickfav","download_url":"https://codeload.github.com/patrickfav/mvn-common-parent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248093297,"owners_count":21046664,"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":["common","maven","maven-parent"],"created_at":"2024-11-23T22:55:08.034Z","updated_at":"2025-04-09T18:53:04.848Z","avatar_url":"https://github.com/patrickfav.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Maven Common Configuration\nA maven configuration which is used as commons config parent for POM files for my maven open source projects. Defines a lot of defaults in `pluginManagement` and some in `dependencyManagement` and activates some plugins.\n\n[![Maven Central](https://img.shields.io/maven-central/v/at.favre.lib/common-parent)](https://mvnrepository.com/artifact/at.favre.lib/common-parent)\n[![Github Actions](https://github.com/patrickfav/mvn-common-parent/actions/workflows/build_deploy.yml/badge.svg)](https://github.com/patrickfav/mvn-common-parent/actions)\n\n## Features\n\nHere is a high level feature set of this project:\n\n* Flexible JDK compiler config with using profiles\n* [Checkstyle](http://checkstyle.sourceforge.net/)\n* [Google Errorprone](https://github.com/google/error-prone) (Java 7)\n* [Maven enforcer](https://maven.apache.org/enforcer/maven-enforcer-plugin/) (for Maven version)\n* [Versions plugin](https://www.mojohaus.org/versions-maven-plugin/)\n* [OWASP dependency checker](https://jeremylong.github.io/DependencyCheck/dependency-check-maven/)\n* [Jacoco](https://www.eclemma.org/jacoco/) + [Coveralls](https://coveralls.io/)\n* [Jarsigner](https://maven.apache.org/plugins/maven-jarsigner-plugin/)\n* [Checksum](https://checksum-maven-plugin.nicoulaj.net/)\n* Default versions for plugins in the [Super POM](http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.html)\n* Default versions for [junit](https://junit.org/junit4/), jackson, [bytes](https://github.com/patrickfav/bytes-java) and more\n\n## Setup\n\nUse as parent pom:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cproject xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\u003e\n    \u003cmodelVersion\u003e4.0.0\u003c/modelVersion\u003e\n    \u003cparent\u003e\n        \u003cgroupId\u003eat.favre.lib\u003c/groupId\u003e\n        \u003cartifactId\u003ecommon-parent\u003c/artifactId\u003e\n        \u003cversion\u003e[current-version]\u003c/version\u003e\n    \u003c/parent\u003e\n    ...\n\u003c/project\u003e\n```\n\nDon't forget to overwrite `\u003cscm\u003e...\u003c/scm\u003e` config, otherwise it will be inherited from this project.\n\n### Maven Wrapper (recommended)\n\nIt is recommended to use [maven wrapper](https://maven.apache.org/wrapper/) in a new project. Initialize with:\n\n```bash\nmvn wrapper:wrapper  \n```\n\nthen you can use `mvnw` instead of `mvn`. The advantage is that everybody (+ci) uses a pre-defined maven version. Even [IntelliJ has Maven wrapper support](https://plugins.jetbrains.com/plugin/10633-maven-wrapper-support).\n\n## Configuration\n\nThere are many ways to easily customize the parent configuration without the need to change the POM itself. Have a look at the `commonConfig.*` properties in the POM and override them as you please in your `\u003cproperties /\u003e`.\n\nImportant config:\n\n```xml\n\u003c!-- set this to true if fail because of missing credentials --\u003e\n\u003ccommonConfig.jarSign.skip\u003efalse\u003c/commonConfig.jarSign.skip\u003e\n```\n\nAdditionally, you can use maven itself to override certain settings. For instance if you want to deactivate checkstyle, just add\n\n```xml\n\u003cplugins\u003e\n    \u003cplugin\u003e\n        \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003emaven-checkstyle-plugin\u003c/artifactId\u003e\n        \u003cconfiguration\u003e\n            \u003cskip\u003etrue\u003c/skip\u003e\n        \u003c/configuration\u003e\n    \u003c/plugin\u003e\n\u003c/plugins\u003e    \n```\n\n### JDK Config\n\nTo set the JDK you want to use, this config uses profiles. The easiest way to activate one of the is to generate the file `.mvn/maven.config` and add e.g.:\n\n```properties\n-DcommonConfig.compiler.profile=jdk8_w_errorprone\n```\n\nCurrently possible values:\n\n* `jdk7`\n* `jdk7_w_errorprone`\n* `jdk8`\n* `jdk8_w_errorprone`\n* `jdk11`\n* `jdk11_w_errorprone`\n* `jdk17`\n* `jdk17_w_errorprone`\n\n\nYou can check if the correct profile is set with\n\n```bash\nmvnw help:active-profiles\nmvnw help:all-profiles\n```\n### Jacoco Minimum Coverage Rules\n\nIf the Jacoco plugin is used, some minimum coverage ratio checks are active. Change them with these properties:\n\n* `commonConfig.jacoco.check.linecov` (60% default)\n* `commonConfig.jacoco.check.methodcov` (70% default)\n* `commonConfig.jacoco.check.classcov` (80% default)\n\nYou may disable the check by setting `commonConfig.jacoco.check.disable` to `true`.\n\n### Reference to Project Root\n\nIf you need to use e.g. a file that lives within your project (e.g. the keystore file for jar-signing) make sure you\nuse the correct base path. There are two useful variables to help you:\n\n* `${project.basedir}` is the path of your current module\n* `${session.executionRootDirectory}` is the root path of your projects (and all your modules) - can be used in\n  submodules\n\n### Deploy\n\nTo deploy use activate the profile `deploy` and then you can use the nexus-staging plugin which deploys to\nsonatype staging, closes the staging repo, then releases it to Maven Central:\n\n```bash\n./mvnw -B verify nexus-staging:deploy -P deploy \u0026\u0026 \\\n./mvnw -B nexus-staging:release -P deploy\n```\n\nThe `verify` is necessary so that the correct lifecycle phase is called and gpg sign is activated.\nThis will also activate gpg sign which needs proper setup in `settings.xml`.\nAs side effect, this will also set property `commonConfig.deployMode.active` if you want to activate other profiles in accordance for example.\n\nSee also https://github.com/sonatype/nexus-maven-plugins/tree/main/staging/maven-plugin\n\n## Built-In Plugins Explained\n\n### Analyze\n\nCheck the created `pom` with\n\n```bash\n./mvnw help:effective-pom\n```\n\nYou may check for updates of any plugins or dependencies with\n\n```bash\n./mvnw versions:display-dependency-updates\n```\n\n### Versions-Plugin\n\nCheck for possible dependency updates\n\n```bash\n./mvnw versions:display-dependency-updates\n./mvnw versions:display-plugin-updates\n./mvnw versions:display-property-updates\n```\n\nSet version through command line (or ci script)\n\n```bash\n./mvnw versions:set -DnewVersion=1.2.3-SNAPSHOT\n```\n\n## Related Projects\n\n* externalized [checkstyle-config](https://github.com/patrickfav/checkstyle-config)\n\n# License\n\nCopyright 2019 Patrick Favre-Bulle\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickfav%2Fmvn-common-parent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickfav%2Fmvn-common-parent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickfav%2Fmvn-common-parent/lists"}