{"id":16057920,"url":"https://github.com/pascalgn/properties-maven-extension","last_synced_at":"2025-03-16T07:32:36.631Z","repository":{"id":44763017,"uuid":"91463173","full_name":"pascalgn/properties-maven-extension","owner":"pascalgn","description":"Maven extension to supply build properties","archived":false,"fork":false,"pushed_at":"2024-08-25T10:57:29.000Z","size":72,"stargazers_count":23,"open_issues_count":5,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-27T05:51:22.828Z","etag":null,"topics":["continuous-integration","gitflow","maven-extension"],"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/pascalgn.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-16T13:43:32.000Z","updated_at":"2024-10-10T13:48:27.000Z","dependencies_parsed_at":"2024-08-25T11:25:40.421Z","dependency_job_id":"dbe5f0cf-36a1-43a6-8a5b-5451abf7935f","html_url":"https://github.com/pascalgn/properties-maven-extension","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascalgn%2Fproperties-maven-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascalgn%2Fproperties-maven-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascalgn%2Fproperties-maven-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pascalgn%2Fproperties-maven-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pascalgn","download_url":"https://codeload.github.com/pascalgn/properties-maven-extension/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806070,"owners_count":20350775,"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":["continuous-integration","gitflow","maven-extension"],"created_at":"2024-10-09T03:05:26.754Z","updated_at":"2025-03-16T07:32:36.154Z","avatar_url":"https://github.com/pascalgn.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# properties-maven-extension\n\n[![License](https://img.shields.io/github/license/pascalgn/properties-maven-extension.svg?style=flat-square)](LICENSE)\n\nA Maven extension to introduce properties *before* the build is started.\nThis allows the usage of dynamic project versions like `1.2.3.${sha1}`.\n\n## Example\n\nFor a simple example, consider the following POM file:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cproject\u003e\n    \u003cmodelVersion\u003e4.0.0\u003c/modelVersion\u003e\n\n    \u003cgroupId\u003ecom.example\u003c/groupId\u003e\n    \u003cartifactId\u003eexample-artifact\u003c/artifactId\u003e\n    \u003cversion\u003e1.2.3.${sha1}\u003c/version\u003e\n\n    \u003cproperties\u003e\n        \u003csha1\u003e${git.commit.id.abbrev}\u003c/sha1\u003e\n    \u003c/properties\u003e\n\u003c/project\u003e\n```\n\nFor a useful project version, the build would have to be invoked like `mvn clean install -Dsha1=abcd123`.\n\nUsing the Properties Maven Extension, this configuration can be set in the project directory itself,\nby adding the following `.mvn/extensions.xml` file to the project:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cextensions\u003e\n    \u003cextension\u003e\n        \u003cgroupId\u003ecom.github.pascalgn\u003c/groupId\u003e\n        \u003cartifactId\u003eproperties-maven-extension\u003c/artifactId\u003e\n        \u003cversion\u003e0.7.0\u003c/version\u003e\n    \u003c/extension\u003e\n\u003c/extensions\u003e\n```\n\nA build is now as easy as `mvn clean install` and the commit hash will be available as a property,\nso that the final project version will be `1.2.3.abcd123` (depending on the current commit hash).\n\n## Requirements\n\nYou will need at least Maven 3.5.0 for this to work. See\n[the release notes](https://maven.apache.org/docs/3.5.0/release-notes.html) for more information.\nYou also need to run your Maven build with at least Java 11 (due to the [JGit](https://eclipse.org/jgit) dependency).\n\n## Properties\n\nThe following properties are currently provided by the extension:\n\n* `git.branch`, the current branch name (*master*, *feature/some-feature*, etc.)\n* `git.build.datetime.simple`, build time in simple datetime format (yyyyMMdd_HHmmss)\n* `git.commit.id`, the full SHA of the HEAD commit (*cbf1b9a1be984a9f61b79a05f23b19f66d533537*)\n* `git.commit.id.abbrev`, the abbreviated SHA of the HEAD commit (*cbf1b9a*)\n* `git.count`, the current number of commits reachable from HEAD\n* `git.commit.color`, always the first six characters of the commit SHA (*cbf1b9*)\n* `git.dir.git`, the absolute path of the repository (*/home/user/workspace/myproject/.git*)\n* `git.dir.worktree`, the absolute path of the working tree (*/home/user/workspace/myproject*)\n* `git.tag.last`, last tag from sorted tag list (*v1.2.3*)\n* `git.describe.long`, combination of tag name and commit SHA (*v1.2.3-27-gcbf1b9a*)\n* `git.describe.tag`, the latest tag reachable from the current branch (*v1.2.3*)\n\nIf you need more properties, feel free to create an [issue](https://github.com/pascalgn/properties-maven-extension/issues)\nor a [pull request](https://github.com/pascalgn/properties-maven-extension/pulls).\n\n## Notes\n\n* When you use placeholders in your version, be sure to also read the [Maven CI Friendly Versions](https://maven.apache.org/maven-ci-friendly.html) guide, especially the section about the [flatten-maven-plugin](http://www.mojohaus.org/flatten-maven-plugin)\n* When building in Jenkins, you might run into the issue that the\n  [branch name is not set due to detached HEAD](https://stackoverflow.com/questions/39297783/detached-head-w-jenkins-git-plugin-and-branch-specifier)\n* The versioning scheme of this project follows [semantic versioning](http://semver.org/)\n\n## Changelog\n\n### Version 0.7.0\n\n- Added new property `git.describe.long`\n- Added new property `git.describe.tag` (see [#64](https://github.com/pascalgn/properties-maven-extension/issues/64))\n\n### Version 0.6.0\n\n- Removed unused color properties\n\n### Version 0.5.1\n\n- Updated maven-core dependency to fix security warnings\n\n### Version 0.5.0\n\n- Changed required Java version from 1.8 to 11\n\n## Related projects\n\n* There are already plugins providing properties, like [maven-git-commit-id-plugin](https://github.com/ktoso/maven-git-commit-id-plugin).\n  However, the POM structure, including versions, is built by Maven before any plugins are executed, hence this extension.\n* The [maven-git-versioning-extension](https://github.com/qoomon/maven-git-versioning-extension) is very similar,\n  but it directly sets the project version, based on existing branches and tags, which makes it less flexible.\n\n## License\n\n[Apache License, Version 2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpascalgn%2Fproperties-maven-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpascalgn%2Fproperties-maven-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpascalgn%2Fproperties-maven-extension/lists"}