Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/opentable/otj-version-exposure-maven-plugin
A custom maven plugin that captures and records the version of the project and its parent pom during the build
https://github.com/opentable/otj-version-exposure-maven-plugin
maven platform-java plugin pom
Last synced: about 6 hours ago
JSON representation
A custom maven plugin that captures and records the version of the project and its parent pom during the build
- Host: GitHub
- URL: https://github.com/opentable/otj-version-exposure-maven-plugin
- Owner: opentable
- License: apache-2.0
- Created: 2019-03-05T00:06:24.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-14T01:27:44.000Z (over 1 year ago)
- Last Synced: 2024-11-30T17:34:22.760Z (about 2 months ago)
- Topics: maven, platform-java, plugin, pom
- Language: Java
- Homepage:
- Size: 45.9 KB
- Stars: 0
- Watchers: 19
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Expose Versions Maven Plugin
The expose versions Maven plugin is designed to help determine the versions of components and expose them, so that they can be accessible to other Maven plugins and to applications at runtime. Which is cool
We basically have 2 types of projects: services and libraries. All of our projects use a common Maven parent POM. That POM is basically our framework, it manages the versions of all of our components.
This plugin does the following:
- It takes the version of the project being built and stores it in a properties file it creates. This way we can access that file at runtime to get the version.
- It exposes the version as a Maven property
- If the project is a service, we find the version of the framework
- We store the framework version in a properties file added to the built artifact
- We expose the framework version as an artifact
We determine that a project is a service by checking for the existence of a specified Maven property.## Configuration
| Property | Description |
| ------------- | ------------- |
| outputDirectory | This is where we should save version files to. This defaults to target/classes. |
| projectVersionFileName | The name of the version file we write for the project. It is also used to create the property name (we append .version to it) that we stored the version number is as well. This defaults to the artifact ID. |
| serviceSignalProperty | A Maven property that when present signals that this project is a service. |
| frameworkGroupId | The group ID of the framework's Maven Parent POM |
| frameworkArtifactId | The group ID of the framework's Maven Parent POM |
| frameworkPropertyName | The group ID of the framework's Maven Parent POM |
| frameworkVersionFileName | The group ID of the framework's Maven Parent POM |
| skip | Should plugin execution be skipped |Example:
```xml
com.opentable
expose-versions-maven-plugin
1.3
generate-resources
run
services.have.this.property.set
com.opentable
framework
framework.version
framework-version
false
```Using the configuration above, if a project with artifact ID `sample-project` with version 123 had the Maven property of `services.have.this.property.set` and had the `com.opentable:framework` parent with version 456, the following would happen:
- A file called `sample-project.properties` would be created and would be accessible in the classpath. It would have one line: `version=123`.
- A Maven property called `sample-project.version` would exist. It would be equal to 123.
- A file called `framework-version.properties` would be created and would be accessible in the classpath. It would have one line: `version=456`.
- A Maven property called `framework.version` would exist. It would be equal to 456.