Skip to content

Commit 9fc4c8f

Browse files
committed
Merge pull request #46 from gluster/BZ_969223
Bz 969223
2 parents aee480a + 5c5a6bb commit 9fc4c8f

File tree

3 files changed

+113
-3
lines changed

3 files changed

+113
-3
lines changed

pom.xml

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>org.apache.hadoop.fs.glusterfs</groupId>
55
<artifactId>glusterfs</artifactId>
66
<packaging>jar</packaging>
7-
<version>0.0.1-${maven.build.timestamp}</version>
7+
<version>snapshot-${maven.build.timestamp}</version>
88
<name>glusterfs</name>
99
<url>http://maven.apache.org</url>
1010
<dependencies>
@@ -82,7 +82,97 @@
8282
<target>1.5</target>
8383
</configuration>
8484
</plugin>
85-
85+
86+
<plugin>
87+
<groupId>pl.project13.maven</groupId>
88+
<artifactId>git-commit-id-plugin</artifactId>
89+
<version>2.1.4</version>
90+
<executions>
91+
<execution>
92+
<goals>
93+
<goal>revision</goal>
94+
</goals>
95+
</execution>
96+
</executions>
97+
98+
<configuration>
99+
<!-- that's the default value, you don't have to set it -->
100+
<prefix>git</prefix>
101+
102+
<!-- that's the default value -->
103+
<dateFormat>dd.MM.yyyy '@' HH:mm:ss z</dateFormat>
104+
105+
<!-- true is default here, it prints some more information during the build -->
106+
<verbose>true</verbose>
107+
108+
<!--
109+
If you'd like to tell the plugin where your .git directory is,
110+
use this setting, otherwise we'll perform a search trying to
111+
figure out the right directory. It's better to add it explicite IMHO.
112+
-->
113+
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
114+
115+
<!-- ALTERNATE SETUP - GENERATE FILE -->
116+
<!--
117+
If you want to keep git information, even in your WAR file etc,
118+
use this mode, which will generate a properties file (with filled out values)
119+
which you can then normally read using new Properties().load(/**/)
120+
-->
121+
122+
<!--
123+
this is true by default; You may want to set this to false, if the plugin should run inside a
124+
<packaging>pom</packaging> project. Most projects won't need to override this property.
125+
126+
For an use-case for this kind of behaviour see: https://github.com/ktoso/maven-git-commit-id-plugin/issues/21
127+
-->
128+
<skipPoms>true</skipPoms>
129+
130+
<!-- this is false by default, forces the plugin to generate the git.properties file -->
131+
<generateGitPropertiesFile>true</generateGitPropertiesFile>
132+
133+
<!-- The path for the to be generated properties file, it's relative to ${project.basedir} -->
134+
<generateGitPropertiesFilename>src/main/resources/git.properties</generateGitPropertiesFilename>
135+
136+
<!-- true by default, controls whether the plugin will fail when no .git directory is found, when set to false the plugin will just skip execution -->
137+
<!-- @since 2.0.4 -->
138+
<failOnNoGitDirectory>false</failOnNoGitDirectory>
139+
140+
<!-- @since 2.1.0 -->
141+
<!--
142+
read up about git-describe on the in man, or it's homepage - it's a really powerful versioning helper
143+
and the recommended way to use git-commit-id-plugin. The configuration bellow is optional,
144+
by default describe will run "just like git-describe on the command line", even though it's a JGit reimplementation.
145+
-->
146+
<gitDescribe>
147+
148+
<!-- don't generate the describe property -->
149+
<skip>false</skip>
150+
151+
<!--
152+
if no tag was found "near" this commit, just print the commit's id instead,
153+
helpful when you always expect this field to be not-empty
154+
-->
155+
<always>false</always>
156+
<!--
157+
how many chars should be displayed as the commit object id?
158+
7 is git's default,
159+
0 has a special meaning (see end of this README.md),
160+
and 40 is the maximum value here
161+
-->
162+
<abbrev>7</abbrev>
163+
164+
<!-- when the build is triggered while the repo is in "dirty state", append this suffix -->
165+
<dirty>-dirty</dirty>
166+
167+
<!--
168+
always print using the "tag-commits_from_tag-g_commit_id-maybe_dirty" format, even if "on" a tag.
169+
The distance will always be 0 if you're "on" the tag.
170+
-->
171+
<forceLongFormat>false</forceLongFormat>
172+
</gitDescribe>
173+
</configuration>
174+
175+
</plugin>
86176

87177
</plugins>
88178
</build>

src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void initialize(URI uri,Configuration conf) throws IOException{
113113
if(this.mounted)
114114
return;
115115

116-
log.info("Initializing GlusterFS");
116+
log.info("Initializing GlusterFS " + new Version().toString().replace(",","\n"));
117117

118118
try{
119119
volName=conf.get("fs.glusterfs.volname", null);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.apache.hadoop.fs.glusterfs;
2+
3+
import java.io.IOException;
4+
import java.util.Properties;
5+
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
8+
9+
public class Version extends Properties{
10+
final static Logger lg = LoggerFactory.getLogger(Version.class);
11+
public Version() {
12+
super();
13+
try{
14+
load(this.getClass().getClassLoader().getResourceAsStream("git.properties"));
15+
}
16+
catch(Throwable t){
17+
lg.error("Couldn't find git properties for version info " + t.getMessage());
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)