Skip to content

Commit dacf4a0

Browse files
author
TheSnoozer
committed
Merge pull request #206 from TheSnoozer/master
Drop support for java jdk1.6 and fix #122
2 parents 98548a7 + e23b0ac commit dacf4a0

File tree

10 files changed

+28
-21
lines changed

10 files changed

+28
-21
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ language: java
22
jdk:
33
- oraclejdk8
44
- oraclejdk7
5-
- openjdk6

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ The current version is **2.1.15** ([changelist](https://github.com/ktoso/maven-g
4242

4343
You can check the available versions by visiting [search.maven.org](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22pl.project13.maven%22%20AND%20a%3A%22git-commit-id-plugin%22), though using the newest is obviously the best choice.
4444

45+
Migration Issues you may come across when using the latest 2.2.X
46+
-----------------------------
47+
If you are already using the git-commit-id-plugin and would like to move to the latest major release (2.2.X) there are some design choices we made to fix some of your issues.
48+
1. We dropped the support of Java 1.6 (if you still rely on this version, the version 2.1.15 still has support for this and you may want to check the fixed issues since then before reporting a new one)
49+
2. We renamed git.commit.id to git.commit.id.full to enable full compability with json (see https://github.com/ktoso/maven-git-commit-id-plugin/issues/122)
50+
51+
I think especially the second one will strike all of our users and we really would like to apologize for any inconvenience :-)
52+
4553
Getting SNAPSHOT versions of the plugin
4654
---------------------------------------
4755
If you really want to use **snapshots**, here's the repository they are deployed to.
@@ -215,7 +223,7 @@ It's really simple to setup this plugin; below is a sample pom that you may base
215223
Please note that the strings here are Java regexes ({@code .*} is globbing, not plain {@code *}).
216224
-->
217225
<includeOnlyProperties>
218-
<!-- <includeOnlyProperty>^git.commit.id$</includeOnlyProperty> -->
226+
<!-- <includeOnlyProperty>^git.commit.id.full$</includeOnlyProperty> -->
219227
</includeOnlyProperties>
220228

221229
<!-- @since 2.1.10 -->
@@ -297,7 +305,7 @@ git.branch=${git.branch}
297305
git.dirty=${git.dirty}
298306
git.remote.origin.url=${git.remote.origin.url}
299307
300-
git.commit.id=${git.commit.id}
308+
git.commit.id.full=${git.commit.id.full}
301309
git.commit.id.abbrev=${git.commit.id.abbrev}
302310
git.commit.id.describe=${git.commit.id.describe}
303311
git.commit.id.describe-short=${git.commit.id.describe-short}
@@ -335,7 +343,7 @@ Start out with with adding the above steps to your project, next paste this **gi
335343
<property name="dirty" value="${git.dirty}"/>
336344
<property name="remoteOriginUrl" value="${git.remote.origin.url}"/>
337345

338-
<property name="commitId" value="${git.commit.id}"/>
346+
<property name="commitId" value="${git.commit.id.full}"/>
339347
<property name="commitIdAbbrev" value="${git.commit.id.abbrev}"/>
340348
<property name="describe" value="${git.commit.id.describe}"/>
341349
<property name="describeShort" value="${git.commit.id.describe-short}"/>
@@ -375,7 +383,7 @@ public class GitRepositoryState {
375383
String dirty; // =${git.dirty}
376384
String remoteOriginUrl; // =${git.remote.origin.url}
377385

378-
String commitId; // =${git.commit.id}
386+
String commitId; // =${git.commit.id.full}
379387
String commitIdAbbrev; // =${git.commit.id.abbrev}
380388
String describe; // =${git.commit.id.describe}
381389
String describeShort; // =${git.commit.id.describe-short}
@@ -506,7 +514,7 @@ public GitRepositoryState(Properties properties)
506514
this.dirty = properties.get("git.dirty").toString();
507515
this.remoteOriginUrl = properties.get("git.remote.origin.url").toString();
508516

509-
this.commitId = properties.get("git.commit.id").toString();
517+
this.commitId = properties.get("git.commit.id.full").toString();
510518
this.commitIdAbbrev = properties.get("git.commit.id.abbrev").toString();
511519
this.describe = properties.get("git.commit.id.describe").toString();
512520
this.describeShort = properties.get("git.commit.id.describe-short").toString();

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<junit.version>4.12</junit.version>
7777
<mockito.version>2.0.5-beta</mockito.version>
7878

79-
<java.target>1.6</java.target>
79+
<java.target>1.7</java.target>
8080
<sourceEncoding>UTF-8</sourceEncoding>
8181
<outputEncoding>UTF-8</outputEncoding>
8282
<fest-assert.version>1.4</fest-assert.version>

src/main/java/pl/project13/maven/git/GitCommitIdMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class GitCommitIdMojo extends AbstractMojo {
6565
// these properties will be exposed to maven
6666
public static final String BRANCH = "branch";
6767
public static final String DIRTY = "dirty";
68-
public static final String COMMIT_ID = "commit.id";
68+
public static final String COMMIT_ID = "commit.id.full";
6969
public static final String COMMIT_ID_ABBREV = "commit.id.abbrev";
7070
public static final String COMMIT_DESCRIBE = "commit.id.describe";
7171
public static final String COMMIT_SHORT_DESCRIBE = "commit.id.describe-short";

src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,9 @@ public void runGitDescribeWithMatchOption(boolean useNativeGit) throws Exception
653653
assertThat(targetProject.getProperties().stringPropertyNames()).contains("git.commit.id.describe");
654654
assertThat(targetProject.getProperties().getProperty("git.commit.id.describe")).startsWith(gitDescribeMatchNeedle);
655655

656-
assertThat(targetProject.getProperties().stringPropertyNames()).contains("git.commit.id");
657-
assertThat(targetProject.getProperties().get("git.commit.id")).isNotEqualTo(commitIdOfMatchNeedle);
658-
assertThat(targetProject.getProperties().get("git.commit.id")).isEqualTo(headCommitId);
656+
assertThat(targetProject.getProperties().stringPropertyNames()).contains("git.commit.id.full");
657+
assertThat(targetProject.getProperties().get("git.commit.id.full")).isNotEqualTo(commitIdOfMatchNeedle);
658+
assertThat(targetProject.getProperties().get("git.commit.id.full")).isEqualTo(headCommitId);
659659
}
660660
}
661661

@@ -765,7 +765,7 @@ private void assertGitPropertiesPresentInProject(Properties properties) {
765765
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.time"));
766766
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.host"));
767767
assertThat(properties).satisfies(new ContainsKeyCondition("git.branch"));
768-
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id"));
768+
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.full"));
769769
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.abbrev"));
770770
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.describe"));
771771
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.name"));

src/test/java/pl/project13/maven/git/GitCommitIdMojoTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void shouldIncludeExpectedProperties() throws Exception {
8080

8181
assertThat(properties).satisfies(new ContainsKeyCondition("git.branch"));
8282
assertThat(properties).satisfies(new ContainsKeyCondition("git.dirty"));
83-
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id"));
83+
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.full"));
8484
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.abbrev"));
8585
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.name"));
8686
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.email"));
@@ -115,7 +115,7 @@ public void shouldExcludeAsConfiguredProperties() throws Exception {
115115

116116
// these stay
117117
assertThat(properties).satisfies(new ContainsKeyCondition("git.branch"));
118-
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id"));
118+
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.full"));
119119
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.abbrev"));
120120
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.message.full"));
121121
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.message.short"));
@@ -125,7 +125,7 @@ public void shouldExcludeAsConfiguredProperties() throws Exception {
125125
@Test
126126
public void shouldIncludeOnlyAsConfiguredProperties() throws Exception {
127127
// given
128-
mojo.setIncludeOnlyProperties(ImmutableList.of("git.remote.origin.url", ".*.user.*", "^git.commit.id$"));
128+
mojo.setIncludeOnlyProperties(ImmutableList.of("git.remote.origin.url", ".*.user.*", "^git.commit.id.full$"));
129129

130130
// when
131131
mojo.execute();
@@ -139,7 +139,7 @@ public void shouldIncludeOnlyAsConfiguredProperties() throws Exception {
139139
// glob included
140140
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.name"));
141141
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.email"));
142-
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id"));
142+
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.full"));
143143
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.user.name"));
144144
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.user.email"));
145145

@@ -176,7 +176,7 @@ public void shouldExcludeAndIncludeAsConfiguredProperties() throws Exception {
176176

177177
// these excluded
178178
assertThat(properties).satisfies(new DoesNotContainKeyCondition("git.branch"));
179-
assertThat(properties).satisfies(new DoesNotContainKeyCondition("git.commit.id"));
179+
assertThat(properties).satisfies(new DoesNotContainKeyCondition("git.commit.id.full"));
180180
assertThat(properties).satisfies(new DoesNotContainKeyCondition("git.commit.id.abbrev"));
181181
assertThat(properties).satisfies(new DoesNotContainKeyCondition("git.commit.message.full"));
182182
assertThat(properties).satisfies(new DoesNotContainKeyCondition("git.commit.message.short"));

src/test/java/pl/project13/maven/git/GitSubmodulesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private void assertGitPropertiesPresentInProject(Properties properties) {
5757
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.time"));
5858
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.host"));
5959
assertThat(properties).satisfies(new ContainsKeyCondition("git.branch"));
60-
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id"));
60+
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.full"));
6161
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.abbrev"));
6262
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.name"));
6363
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.email"));

src/test/java/pl/project13/maven/git/NaivePerformanceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private void assertGitPropertiesPresentInProject(Properties properties) {
9595
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.time"));
9696
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.host"));
9797
assertThat(properties).satisfies(new ContainsKeyCondition("git.branch"));
98-
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id"));
98+
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.full"));
9999
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.abbrev"));
100100
assertThat(properties).satisfies(new ContainsKeyCondition("git.commit.id.describe"));
101101
assertThat(properties).satisfies(new ContainsKeyCondition("git.build.user.name"));

src/test/java/pl/project13/maven/git/NativeAndJGitProviderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class NativeAndJGitProviderTest extends GitIntegrationTest
3737
"git.build.time",
3838
"git.build.host",
3939
"git.branch",
40-
"git.commit.id",
40+
"git.commit.id.full",
4141
"git.commit.id.abbrev",
4242
"git.commit.id.describe",
4343
"git.build.user.name",

src/test/resources/git.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ git.build.user.name=${git.build.user.name}
2121
git.build.user.email=${git.build.user.email}
2222
git.build.time=${git.build.time}
2323

24-
git.commit.id=${git.commit.id}
24+
git.commit.id.full=${git.commit.id.full}
2525
git.commit.id.abbrev=${git.commit.id.abbrev}
2626
git.commit.user.name=${git.commit.user.name}
2727
git.commit.user.email=${git.commit.user.email}

0 commit comments

Comments
 (0)