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


##########
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);

Review Comment:
   > > Also, I think this removing _all_ matching files from the temporary 
directory is problematic. If we have two concurrent builds running, one of the 
files will be lost. This may be done only when `buildDirectory != null`.
   > 
   > It would be a problem. I don't think we can safely delete any files in 
that case without introducing too much complexity, so the behaviour would be to 
just let the files live in the temp dir and _maybe_ get cleaned up by the OS. 
Some do and some don't.
   
   There may be a better alternative.  I wonder if we could just add a 
`@PreDestroy` method that would keep a list of generated files (be it in the 
temp directory or in the build directory) and delete them when the bean is 
destroy...
   
   > I didn't know the temp dir would/could be used as build directory (I just 
looked and the files were indeed there). Out of curiosity; when would this be 
the case?
   
   Actually, I did not know either, I just noticed it while reviewing this PR.  
   



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