Skip to content

Commit 242dcfd

Browse files
author
TheSnoozer
committed
Merge pull request #184 from TheSnoozer/master
Introduce a demo-profile inside the pom, see #181
2 parents 75d855e + 3299e83 commit 242dcfd

File tree

2 files changed

+51
-43
lines changed

2 files changed

+51
-43
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ But I highly recommend using only stable versions, from maven central... :-)
5555
</pluginRepositories>
5656
```
5757

58+
If you just would like to see what the plugin can do, you can clone the repository and run
59+
```
60+
mvn clean install -Dmaven.test.skip=true && mvn clean package -Pdemo -Dmaven.test.skip=true
61+
```
62+
5863
Using the plugin
5964
----------------
6065
It's really simple to setup this plugin; below is a sample pom that you may base your **pom.xml** on. Note that it binds to the initialize phase by default such that all Git properties are available for use throughout the build lifecycle.

pom.xml

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@
122122
</dependency>
123123

124124
<!-- JGit -->
125-
126125
<dependency>
127126
<groupId>org.eclipse.jgit</groupId>
128127
<artifactId>org.eclipse.jgit</artifactId>
@@ -188,48 +187,7 @@
188187
</resources>
189188

190189
<plugins>
191-
<!--<plugin>-->
192-
<!--<groupId>pl.project13.maven</groupId>-->
193-
<!--<artifactId>git-commit-id-plugin</artifactId>-->
194-
<!--<version>${project.version}</version>-->
195-
<!--<executions>-->
196-
<!--<execution>-->
197-
<!--<goals>-->
198-
<!--<goal>revision</goal>-->
199-
<!--</goals>-->
200-
<!--</execution>-->
201-
<!--</executions>-->
202-
<!--<configuration>-->
203-
<!--<verbose>true</verbose>-->
204-
<!--<skip>false</skip>-->
205-
<!--<prefix>git</prefix>-->
206-
<!--<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>-->
207-
<!--<generateGitPropertiesFile>true</generateGitPropertiesFile>-->
208-
<!--<generateGitPropertiesFilename>target/testing.properties</generateGitPropertiesFilename>-->
209-
210-
<!--<dateFormat>dd.MM.yyyy '@' HH:mm:ss z</dateFormat>-->
211-
<!--<useNativeGit>false</useNativeGit>-->
212-
<!--<abbrevLength>7</abbrevLength>-->
213-
<!--<format>properties</format>-->
214-
215-
<!--<gitDescribe>-->
216-
<!--<skip>false</skip>-->
217-
<!--<always>false</always>-->
218-
<!--<abbrev>7</abbrev>-->
219-
<!--<match>*</match>-->
220-
<!--<dirty>-DEVEL</dirty>-->
221-
<!--<forceLongFormat>false</forceLongFormat>-->
222-
<!--</gitDescribe>-->
223-
224-
<!--<excludeProperties>-->
225-
<!--<excludeProperty>git.commit.*</excludeProperty>-->
226-
<!--<excludeProperty>git.remote.origin.url</excludeProperty>-->
227-
<!--</excludeProperties>-->
228-
229-
<!--<failOnNoGitDirectory>true</failOnNoGitDirectory>-->
230-
<!--<failOnUnableToExtractRepoInfo>true</failOnUnableToExtractRepoInfo>-->
231-
<!--</configuration>-->
232-
<!--</plugin>-->
190+
<!-- if you would like to run the git-commit-id-plugin for your build, you could also include it here instead using a profile (see README.md) -->
233191
<!-- Setting built-in java compiler properties -->
234192
<plugin>
235193
<groupId>org.apache.maven.plugins</groupId>
@@ -294,6 +252,51 @@
294252
</plugins>
295253
</build>
296254
</profile>
255+
<profile>
256+
<id>demo</id>
257+
<build>
258+
<plugins>
259+
<plugin>
260+
<groupId>pl.project13.maven</groupId>
261+
<artifactId>git-commit-id-plugin</artifactId>
262+
<version>${project.version}</version>
263+
<executions>
264+
<execution>
265+
<goals>
266+
<goal>revision</goal>
267+
</goals>
268+
</execution>
269+
</executions>
270+
<configuration>
271+
<verbose>true</verbose>
272+
<skip>false</skip>
273+
<prefix>git</prefix>
274+
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
275+
<generateGitPropertiesFile>true</generateGitPropertiesFile>
276+
<generateGitPropertiesFilename>target/testing.properties</generateGitPropertiesFilename>
277+
<dateFormat>dd.MM.yyyy '@' HH:mm:ss z</dateFormat>
278+
<useNativeGit>false</useNativeGit>
279+
<abbrevLength>7</abbrevLength>
280+
<format>properties</format>
281+
<gitDescribe>
282+
<skip>false</skip>
283+
<always>false</always>
284+
<abbrev>7</abbrev>
285+
<match>*</match>
286+
<dirty>-DEVEL</dirty>
287+
<forceLongFormat>false</forceLongFormat>
288+
</gitDescribe>
289+
<excludeProperties>
290+
<excludeProperty>git.commit.*</excludeProperty>
291+
<excludeProperty>git.remote.origin.url</excludeProperty>
292+
</excludeProperties>
293+
<failOnNoGitDirectory>false</failOnNoGitDirectory>
294+
<failOnUnableToExtractRepoInfo>true</failOnUnableToExtractRepoInfo>
295+
</configuration>
296+
</plugin>
297+
</plugins>
298+
</build>
299+
</profile>
297300
</profiles>
298301
</project>
299302

0 commit comments

Comments
 (0)