{"id":21822807,"url":"https://github.com/outbrain-inc/ci-friendly-flatten-maven-plugin","last_synced_at":"2026-03-15T23:02:50.998Z","repository":{"id":38395663,"uuid":"301950810","full_name":"outbrain-inc/ci-friendly-flatten-maven-plugin","owner":"outbrain-inc","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-16T14:28:03.000Z","size":176,"stargazers_count":63,"open_issues_count":10,"forks_count":14,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-31T17:20:29.188Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/outbrain-inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-10-07T06:49:54.000Z","updated_at":"2025-02-21T10:33:47.000Z","dependencies_parsed_at":"2024-03-28T10:33:04.523Z","dependency_job_id":"9127fcc0-aad8-4dbf-9068-d8cd6ccaf3e5","html_url":"https://github.com/outbrain-inc/ci-friendly-flatten-maven-plugin","commit_stats":null,"previous_names":["outbrain-inc/ci-friendly-flatten-maven-plugin","outbrain/ci-friendly-flatten-maven-plugin"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Fci-friendly-flatten-maven-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Fci-friendly-flatten-maven-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Fci-friendly-flatten-maven-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Fci-friendly-flatten-maven-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outbrain-inc","download_url":"https://codeload.github.com/outbrain-inc/ci-friendly-flatten-maven-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767234,"owners_count":20992547,"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":[],"created_at":"2024-11-27T17:17:50.299Z","updated_at":"2026-03-15T23:02:45.957Z","avatar_url":"https://github.com/outbrain-inc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ci-friendly-flatten-maven-plugin \n\nThis is the [ci-friendly-flatten-maven-plugin](https://github.com/outbrain/ci-friendly-flatten-maven-plugin).\n\n[![Apache License V.2](https://img.shields.io/badge/license-Apache%20V.2-blue.svg)](https://github.com/outbrain/ci-friendly-plugin/blob/master/LICENSE) \n[![Build Status](https://travis-ci.org/outbrain/ci-friendly-flatten-maven-plugin.svg?branch=main)](https://travis-ci.org/github/outbrain/ci-friendly-flatten-maven-plugin)\n[![Maven Central](https://img.shields.io/maven-central/v/com.outbrain.swinfra/ci-friendly-flatten-maven-plugin.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cci-friendly-flatten-maven-plugin)\n\n## Why another flatten plugin?\nHaving a large (\u003e 350 modules) reactor with multiple daily releases,\nwe encountered two issues:\n1) Commit history littered with maven release plugin commits.\n2) Race between committers pushing to the main branch, and the release plugin pushing its own pom changes.\n\nWhen we found out about [ci friendly versions](https://maven.apache.org/maven-ci-friendly.html), we were ecstatic - finally we can avoid having\nversions in poms and achieve zero commits release process!\n\nThe only problem was that the [flatten plugin](https://www.mojohaus.org/flatten-maven-plugin) coupled with the `resolveCiFriendliesOnly`\noption [does not work](https://github.com/mojohaus/flatten-maven-plugin/issues/51#issuecomment-566069689).\nAs adherers of the [unix philosophy](https://en.wikipedia.org/wiki/Unix_philosophy#:~:text=The%20Unix%20philosophy%20emphasizes%20building,as%20opposed%20to%20monolithic%20design.),\nwe decided to create a plugin that truly, really, only replaces the `revision`, `sha` and `changelist` properties. \n\n## Quickstart\nThis plugin flattens a pom by replacing `${revision}`, `${sha1}`, `${changelist}` to \n values you set by passing them as args.\n It then writes the resulting pom to a file named `.ci-friendly-pom.xml` and sets it as the new reactor.\n For example, installing version 2.0.0:\n \n    mvn -Drevision=2.0.0 clean install\n   \n## Plugin setup\n```xml\n   \u003cbuild\u003e\n        \u003cplugins\u003e\n          \u003cplugin\u003e\n            \u003cgroupId\u003ecom.outbrain.swinfra\u003c/groupId\u003e\n            \u003cartifactId\u003eci-friendly-flatten-maven-plugin\u003c/artifactId\u003e\n            \u003c!--\u003cversion\u003eINSERT LATEST VERSION HERE\u003c/version\u003e--\u003e\n            \u003cexecutions\u003e\n              \u003cexecution\u003e\n                \u003cgoals\u003e\n                  \u003c!-- Ensure proper cleanup. Will run on clean phase--\u003e\n                  \u003cgoal\u003eclean\u003c/goal\u003e\n                  \u003c!-- Enable ci-friendly version resolution. Will run on process-resources phase--\u003e\n                  \u003cgoal\u003eflatten\u003c/goal\u003e\n                \u003c/goals\u003e\n              \u003c/execution\u003e\n            \u003c/executions\u003e\n          \u003c/plugin\u003e\n        \u003c/plugins\u003e\n   \u003c/build\u003e\n```\n## Plugin Goals\n - `ci-friendly-flatten:flatten` Replaces `revision`, `sha1`, `changelist`, writes the resolved pom file to `.ci-friendly-pom.xml` and sets it as the new reactor (Default maven phase binding: process-resources).\n - `ci-friendly-flatten:clean` Removes any files created by ci-friendly-flatten:flatten (Default maven phase binding: clean).\n - `ci-friendly-flatten:version` Fetches the latest git tag, increments it and writes it to revision.txt, relies on [scm configuration](https://maven.apache.org/scm/maven-scm-plugin/usage.html).\n - `ci-friendly-flatten:scmTag` Tags the commit with the updated version and pushes the tag, relies on [scm configuration](https://maven.apache.org/scm/maven-scm-plugin/usage.html).\n \n## Installing artifacts\n\n1. To avoid having to type `-Drevision=\u003cversion\u003e` when installing locally, define a default revision property. \n\n         \u003cproperties\u003e\n            \u003crevision\u003e5.0.0-SNAPSHOT\u003c/revision\u003e\n         \u003c/properties\u003e\n\n`mvn clean install`\n\nWill install all artifacts with 5.0.0-SNAPSHOT version.\n\n2. Provide the version with revision arg\n\n`mvn clean install -Drevision=\u003cVERSION\u003e`\n\nWill install all artifacts with your provided *VERSION*\n\n## Deploying artifacts\n\nSame as above, just use `mvn clean deploy -Drevision=\u003cVERSION\u003e`\n\n\n## How we configured it ?\n\n1. We added *ci-friendly-flatten-maven-plugin* to our pom.xml.\n2. TeamCity Configuration:\n    \n    - Added a project system param `system.version`.\n    \n    - The project build steps:\n     \n      - Step #0 New project should tag their project before step 1 ([git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging)) \n      \n        `git tag -a \"1.0.0\" -m \"my version '1.0.0'\"`\n      \n        `git push origin \"1.0.0\"`        \n\n      - Step #1 - (Maven step) Fetch the latest git tag, increment it and write the result to revision.txt.\n      This is the version we are going to release.\n\n        `mvn ci-friendly-flatten:version`\n      - Step #2 - (Command line step) Set a `system.version` TeamCity parameter with our soon to be released version, in order to use it in the next steps\n      \n        ```\n        #!/bin/bash -x\n        VER_PATH=\"%teamcity.build.checkoutDir%/revision.txt\"\n        REV=`cat $VER_PATH`\n        set +x\n        echo \"##teamcity[setParameter name='system.version' value='$REV']\"\n        ```\n      - Step #3 - (Maven step) deploy\n       \n          `mvn clean deploy -Drevision=%system.version%`\n      - Step #4 - (Maven step) Tag the current commit with the updated version and push the tag\n      \n          `mvn ci-friendly-flatten:scmTag -Drevision=%system.version%`        \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutbrain-inc%2Fci-friendly-flatten-maven-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutbrain-inc%2Fci-friendly-flatten-maven-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutbrain-inc%2Fci-friendly-flatten-maven-plugin/lists"}