@@ -1207,24 +1207,10 @@ public void error(String msg, Throwable t) {
1207
1207
return ;
1208
1208
}
1209
1209
1210
- dotGitDirectory = lookupGitDirectory ();
1211
- if (failOnNoGitDirectory && !directoryExists (dotGitDirectory )) {
1212
- throw new GitCommitIdExecutionException (
1213
- ".git directory is not found! Please specify a valid [dotGitDirectory] in your"
1214
- + " pom.xml" );
1215
- }
1216
-
1217
1210
if (gitDescribe == null ) {
1218
1211
gitDescribe = new GitDescribeConfig ();
1219
1212
}
1220
1213
1221
- if (dotGitDirectory != null ) {
1222
- log .info ("dotGitDirectory '" + dotGitDirectory .getAbsolutePath () + "'" );
1223
- } else {
1224
- log .info ("dotGitDirectory is null, aborting execution!" );
1225
- return ;
1226
- }
1227
-
1228
1214
try {
1229
1215
commitIdGenerationModeEnum =
1230
1216
CommitIdGenerationMode .valueOf (commitIdGenerationMode .toUpperCase ());
@@ -1411,6 +1397,11 @@ public Charset getPropertiesSourceCharset() {
1411
1397
public boolean shouldPropertiesEscapeUnicode () {
1412
1398
return generateGitPropertiesFileWithEscapedUnicode ;
1413
1399
}
1400
+
1401
+ @ Override
1402
+ public boolean shouldFailOnNoGitDirectory () {
1403
+ return failOnNoGitDirectory ;
1404
+ }
1414
1405
};
1415
1406
1416
1407
GitCommitIdPlugin .runPlugin (cb , properties );
@@ -1503,16 +1494,6 @@ private void appendPropertiesToReactorProjects(LogInterface log, Properties prop
1503
1494
log .info ("Added properties to '" + reactorProjects .size () + "' projects" );
1504
1495
}
1505
1496
1506
- /**
1507
- * Find the git directory of the currently used project. If it's not already specified, this
1508
- * method will try to find it.
1509
- *
1510
- * @return the File representation of the .git directory
1511
- */
1512
- private File lookupGitDirectory () throws GitCommitIdExecutionException {
1513
- return new GitDirLocator (project , reactorProjects ).lookupGitDirectory (dotGitDirectory );
1514
- }
1515
-
1516
1497
private void logProperties (LogInterface log , Properties propertiesToPublish ) {
1517
1498
for (String propertyName : propertiesToPublish .stringPropertyNames ()) {
1518
1499
log .info ("including property '" + propertyName + "' in results" );
@@ -1522,8 +1503,4 @@ private void logProperties(LogInterface log, Properties propertiesToPublish) {
1522
1503
private boolean isPomProject (@ Nonnull MavenProject project ) {
1523
1504
return project .getPackaging ().equalsIgnoreCase ("pom" );
1524
1505
}
1525
-
1526
- private boolean directoryExists (@ Nullable File fileLocation ) {
1527
- return fileLocation != null && fileLocation .exists () && fileLocation .isDirectory ();
1528
- }
1529
1506
}
0 commit comments