You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exports git version info to maven as properties in the `pom.xml` and as a file in the build output. Code generation and resource loading enable access to the build's version info at runtime.
8
+
Unsure if this addresses your problem? [Read about common use cases](docs/use-cases.md).
8
9
9
-
git-commit-id-maven-plugin is a plugin quite similar to [Build Number Maven Plugin](https://www.mojohaus.org/buildnumber-maven-plugin/index.html) for example but as the Build Number plugin at the time when I started this plugin only supported CVS and SVN, something had to be done.
10
-
I had to quickly develop a Git version of such a plugin. For those who don't know the plugin, it basically helps you with the following tasks and answers related questions
11
-
* Which version had the bug? Is that deployed already?
12
-
* Make your distributed deployment aware of versions
13
-
* Validate if properties are set as expected
14
-
15
-
If you are more interested in the different use-cases, feel free to [read about them in more detail](docs/use-cases.md).
16
-
17
-
Quicklinks (all relevant documentation)
18
-
==================
19
-
*[Use case documentation](docs/use-cases.md)
20
-
*[Using the plugin documentation (all details for configuration, properties, ...)](docs/using-the-plugin.md)
21
-
*[A more technical documentation on how to use the leverage the generated properties from this plugin](docs/using-the-plugin-in-more-depth.md)
22
-
*[A general documentation for git describe (usefull feature in this plugin, if you are not familiar with the command)](docs/git-describe.md)
23
-
*[All configuration options are documented inside `GitCommitIdMojo.java` as Javadoc](src/main/java/pl/project13/maven/git/GitCommitIdMojo.java#L98)
24
-
*[Frequently Asked Question (FAQ)](docs/faq.md)
25
-
*[Contributing](CONTRIBUTING.md)
26
-
27
-
Getting the plugin
28
-
==================
29
-
The plugin **is available from Maven Central** ([see here](https://search.maven.org/artifact/io.github.git-commit-id/git-commit-id-maven-plugin)), so you don't have to configure any additional repositories to use this plugin.
30
-
31
-
A detailed description of using the plugin is available in the [Using the plugin](docs/using-the-plugin.md) document. All you need to do in the basic setup is to include that plugin definition in your `pom.xml`.
32
-
For more advanced users we also prepared a [guide to provide a brief overview of the more advanced configurations](docs/using-the-plugin.md)... read on!
33
-
34
-
Relocation of the Project
35
-
------------------------
36
-
Newer version (5.x.x or more recent) are available via
The current version is **9.0.0** ([changelist](https://github.com/git-commit-id/git-commit-id-maven-plugin/issues?q=milestone%3A9.0.0)).
50
-
51
-
You can check the available versions by visiting [search.maven.org](https://search.maven.org/artifact/io.github.git-commit-id/git-commit-id-maven-plugin), though using the newest is obviously the best choice.
52
-
53
-
Plugin compatibility with Java
54
-
-------------------------------
55
-
Here is an overview of the current plugin compatibility with Java
56
-
57
-
| Plugin Version | Required Java Version |
58
-
| --------------- | ---------------------:|
59
-
| 2.1.X | Java 1.6 |
60
-
| 2.2.X | Java 1.7 |
61
-
| 3.X.X | Java 1.8 |
62
-
| 4.X.X | Java 1.8 |
63
-
| 5.X.X | Java 11 |
64
-
| 6.X.X | Java 11 |
65
-
| 7.X.X | Java 11 |
66
-
| 8.X.X | Java 11 |
67
-
| 9.X.X | Java 11 |
68
-
69
-
70
-
Plugin compatibility with Maven
71
-
-----------------------------
72
-
Even though this plugin tries to be compatible with every Maven version there are some known limitations with specific versions. Here is a list that tries to outline the current state of the art:
73
-
74
-
| Plugin Version | Minimal Required Maven version |
| Maven 2.0.11 | up to 2.2.6 | Maven 2 is EOL, git-commit-id-plugin:1.0 doesn't work -- requires maven version 2.2.1 |
108
-
| Maven 2.2.1 | up to 2.2.6 | Maven 2 is EOL |
109
-
| Maven 3.0.X | up to 4.0.5 | git-commit-id-plugin:2.1.14, 2.1.15, 2.2.0, 2.2.1, 2.2.3 doesn't work -- requires maven version 3.1.1 |
110
-
| Maven 3.0.X | up to 4.0.5 | For git-commit-id-plugin 2.2.4 or higher: works, but failed to load class "org.slf4j.impl.StaticLoggerBinder" |
111
-
| Maven 3.1.0 | any | git-commit-id-plugin:2.1.14, 2.1.15, 2.2.0, 2.2.1, 2.2.3 doesn't work -- requires maven version 3.1.1 |
112
-
| Maven 3.3.1 | any | git-commit-id-plugin:2.1.14 doesn't work |
113
-
| Maven 3.3.3 | any | git-commit-id-plugin:2.1.14 doesn't work |
114
-
115
-
Note:
116
-
As an example -- this table should be read as: For `Maven 3.1.0``any` Plugin Version should work, besides the ones listed in the `Notes` have the limitations listed.
117
-
118
-
119
-
Getting SNAPSHOT versions of the plugin
120
-
---------------------------------------
121
-
If you really want to use **snapshots**, here's the repository they are deployed to.
122
-
But I highly recommend using only stable versions, from Maven Central... :-)
123
-
10
+
## Quick Start
11
+
The plugin is **available from [Maven Central](https://central.sonatype.com/artifact/io.github.git-commit-id/git-commit-id-maven-plugin)**. Simply add the following to your `pom.xml`:
This project is currently maintained thanks to: @ktoso (founder), @TheSnoozer
145
52
146
-
147
-
Notable contributions
148
-
=====================
53
+
## Notable contributions
149
54
I'd like to give a big thanks to some of these folks, for their suggestions and / or pull requests that helped make this plugin as popular as it is today:
150
55
151
56
*@mostr - for bugfixes and a framework to do integration testing,
@@ -156,25 +61,21 @@ I'd like to give a big thanks to some of these folks, for their suggestions and
156
61
* ... many others - thank you for your contributions,
157
62
* ... you! - for using the plugin :-)
158
63
159
-
Notable happy users
160
-
===================
161
-
64
+
## Notable happy users
162
65
*[neo4j](https://neo4j.com/) – graph database
163
66
*[FoundationdDB](https://www.foundationdb.org/) – another open source database
164
67
*[Spring Boot](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-maven) – yes, the upstream Spring project is using us
I'm releasing this plugin under the **GNU Lesser General Public License 3.0**.
173
75
174
76
You're free to use it as you wish, the full license text is attached in the LICENSE file.
175
77
176
-
Feature requests
177
-
================
78
+
## Feature requests
178
79
The best way to ask for features / improvements is [via the Issues section on GitHub - it's better than email](https://github.com/git-commit-id/git-commit-id-maven-plugin/issues) because I won't loose when I have a "million emails inbox" day,
179
80
and maybe someone else has some idea or would like to upvote your issue.
This file demonstrates multiple ways to access at runtime the git version info that was exported at buildtime.
3
+
4
+
## Generate A Java Source File with Compile Time Constants
5
+
This strategy generates a Java source file from a template and writes it to the `generated-sources` directory within the `target` directory. This is useful for avoiding runtime injection and/or lookup from properties files.
6
+
7
+
Add the [templating-maven-plugin](https://github.com/mojohaus/templating-maven-plugin) to your pom.xml:
8
+
```xml
9
+
<plugin>
10
+
<groupId>org.codehaus.mojo</groupId>
11
+
<artifactId>templating-maven-plugin</artifactId>
12
+
<version>3.0.0</version>
13
+
<executions>
14
+
<execution>
15
+
<goals>
16
+
<goal>filter-sources</goal>
17
+
</goals>
18
+
<phase>generate-sources</phase>
19
+
</execution>
20
+
</executions>
21
+
</plugin>
22
+
```
23
+
24
+
Add the template file to `src/main/java-templates`:
0 commit comments