@@ -486,21 +486,19 @@ void loadGitDataWithJGit(@NotNull Properties properties) throws IOException, Moj
486486 jGitProvider .loadGitData (properties );
487487 }
488488
489- static int counter ;
490-
491489 void generatePropertiesFile (@ NotNull Properties properties , File base , String propertiesFilename ) throws IOException {
492490 FileWriter fileWriter = null ;
493- File gitPropsFile = new File (base , propertiesFilename );
491+ File gitPropsFile = craftPropertiesOutputFile (base , propertiesFilename );
494492 try {
495493 Files .createParentDirs (gitPropsFile );
496494
497495 fileWriter = new FileWriter (gitPropsFile );
498496 if ("json" .equalsIgnoreCase (format )) {
499- log ("Writing json file to [" , gitPropsFile .getAbsolutePath (), "] (for module " , project .getName () + (++ counter ) , ")..." );
497+ log ("Writing json file to [" , gitPropsFile .getAbsolutePath (), "] (for module " , project .getName (), ")..." );
500498 ObjectMapper mapper = new ObjectMapper ();
501499 mapper .writeValue (fileWriter , properties );
502500 } else {
503- log ("Writing properties file to [" , gitPropsFile .getAbsolutePath (), "] (for module " , project .getName () + (++ counter ) , ")..." );
501+ log ("Writing properties file to [" , gitPropsFile .getAbsolutePath (), "] (for module " , project .getName (), ")..." );
504502 properties .store (fileWriter , "Generated by Git-Commit-Id-Plugin" );
505503 }
506504
@@ -511,6 +509,19 @@ void generatePropertiesFile(@NotNull Properties properties, File base, String pr
511509 }
512510 }
513511
512+ @ VisibleForTesting
513+ File craftPropertiesOutputFile (File base , String propertiesFilename ){
514+ File returnPath = new File (base , propertiesFilename );
515+
516+ File currentPropertiesFilepath = new File (propertiesFilename );
517+ if (currentPropertiesFilepath .isAbsolute ()){
518+ returnPath = currentPropertiesFilepath ;
519+ }
520+
521+ return returnPath ;
522+ }
523+
524+
514525 boolean isPomProject (@ NotNull MavenProject project ) {
515526 return project .getPackaging ().equalsIgnoreCase ("pom" );
516527 }
0 commit comments