[GitHub] [maven] mthmulders commented on a diff in pull request #1105: [MNG-7740] Remove old temporary consumer*pom files from buildDir

2023-05-12 Thread via GitHub


mthmulders commented on code in PR #1105:
URL: https://github.com/apache/maven/pull/1105#discussion_r1192132236


##
maven-core/src/main/java/org/apache/maven/internal/transformation/ConsumerPomArtifactTransformer.java:
##
@@ -77,13 +80,34 @@ public void injectTransformedArtifacts(MavenProject 
project, RepositorySystemSes
 Files.createDirectories(buildDir);
 generatedFile = Files.createTempFile(buildDir, 
CONSUMER_POM_CLASSIFIER, "pom");
 }
+
+removeOldConsumerPomFiles(generatedFile);
+
 project.addAttachedArtifact(new ConsumerPomArtifact(project, 
generatedFile, session));
 } else if (project.getModel().isRoot()) {
 throw new IllegalStateException(
 "The use of the root attribute on the model requires the 
buildconsumer feature to be active");
 }
 }
 
+private void removeOldConsumerPomFiles(Path generatedFile) throws 
IOException {
+List oldConsumerPomFiles;

Review Comment:
   That makes perfect sense to me. Thanks for commenting on this!



-- 
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



[GitHub] [maven] mthmulders commented on a diff in pull request #1105: [MNG-7740] Remove old temporary consumer*pom files from buildDir

2023-05-11 Thread via GitHub


mthmulders commented on code in PR #1105:
URL: https://github.com/apache/maven/pull/1105#discussion_r1191343803


##
maven-core/src/main/java/org/apache/maven/internal/transformation/ConsumerPomArtifactTransformer.java:
##
@@ -77,13 +80,34 @@ public void injectTransformedArtifacts(MavenProject 
project, RepositorySystemSes
 Files.createDirectories(buildDir);
 generatedFile = Files.createTempFile(buildDir, 
CONSUMER_POM_CLASSIFIER, "pom");
 }
+
+removeOldConsumerPomFiles(generatedFile);
+
 project.addAttachedArtifact(new ConsumerPomArtifact(project, 
generatedFile, session));
 } else if (project.getModel().isRoot()) {
 throw new IllegalStateException(
 "The use of the root attribute on the model requires the 
buildconsumer feature to be active");
 }
 }
 
+private void removeOldConsumerPomFiles(Path generatedFile) throws 
IOException {
+List oldConsumerPomFiles;

Review Comment:
   Why does the code collect all the files in a list if it could as well remove 
them in the terminal operation of the `j.u.s.Stream`?



-- 
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