gnodet commented on PR #77:
URL: https://github.com/apache/maven-archiver/pull/77#issuecomment-2502177476

   I'd go for something like:
   ```
       private void createPropertiesFile(Properties properties, Path outputFile)
               throws IOException {
           Path outputDir = outputFile.getParent();
           if (outputDir != null && !Files.isDirectory(outputDir)) {
               Files.createDirectories(outputDir);
           }
           StringWriter sw = new StringWriter();
           properties.store(sw, null);
           String nl = System.lineSeparator();
           String output = Stream.of(sw.toString().split("\\R"))
                   .filter(line -> !line.startsWith("#"))
                   .sorted()
                   .collect(Collectors.joining(nl, "", nl));
           try (Writer pw = new CachingWriter(outputFile, 
StandardCharsets.ISO_8859_1)) {
               pw.write(output);
           }
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to