@@ -1207,24 +1207,10 @@ public void error(String msg, Throwable t) {
12071207 return ;
12081208 }
12091209
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-
12171210 if (gitDescribe == null ) {
12181211 gitDescribe = new GitDescribeConfig ();
12191212 }
12201213
1221- if (dotGitDirectory != null ) {
1222- log .info ("dotGitDirectory '" + dotGitDirectory .getAbsolutePath () + "'" );
1223- } else {
1224- log .info ("dotGitDirectory is null, aborting execution!" );
1225- return ;
1226- }
1227-
12281214 try {
12291215 commitIdGenerationModeEnum =
12301216 CommitIdGenerationMode .valueOf (commitIdGenerationMode .toUpperCase ());
@@ -1411,6 +1397,11 @@ public Charset getPropertiesSourceCharset() {
14111397 public boolean shouldPropertiesEscapeUnicode () {
14121398 return generateGitPropertiesFileWithEscapedUnicode ;
14131399 }
1400+
1401+ @ Override
1402+ public boolean shouldFailOnNoGitDirectory () {
1403+ return failOnNoGitDirectory ;
1404+ }
14141405 };
14151406
14161407 GitCommitIdPlugin .runPlugin (cb , properties );
@@ -1503,16 +1494,6 @@ private void appendPropertiesToReactorProjects(LogInterface log, Properties prop
15031494 log .info ("Added properties to '" + reactorProjects .size () + "' projects" );
15041495 }
15051496
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-
15161497 private void logProperties (LogInterface log , Properties propertiesToPublish ) {
15171498 for (String propertyName : propertiesToPublish .stringPropertyNames ()) {
15181499 log .info ("including property '" + propertyName + "' in results" );
@@ -1522,8 +1503,4 @@ private void logProperties(LogInterface log, Properties propertiesToPublish) {
15221503 private boolean isPomProject (@ Nonnull MavenProject project ) {
15231504 return project .getPackaging ().equalsIgnoreCase ("pom" );
15241505 }
1525-
1526- private boolean directoryExists (@ Nullable File fileLocation ) {
1527- return fileLocation != null && fileLocation .exists () && fileLocation .isDirectory ();
1528- }
15291506}
0 commit comments