[ 
https://issues.apache.org/jira/browse/MCLEAN-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17895979#comment-17895979
 ] 

Peter De Maeyer edited comment on MCLEAN-124 at 11/6/24 7:42 PM:
-----------------------------------------------------------------

The stack trace is coming from {{Cleaner.delete:300}}, which is Maven code, not 
Java (JDK) code. There is no Java exception there. There are multiple 
complications there: on Windows or not, retries with {{Thread.sleep}}{^}(1)^ 
and back-off delays.

This issue is missing a concrete situation illustrating an actual lack of 
information. Java's own {{File.delete}} API, which is used underneath, doesn't 
give more accurate information either besides {{true}} "delete successful" or 
{{false}} "delete unsuccessful". We could migrate to Java 7's improved 
{{Files.delete}} API, which instead throws exceptions with more accurate 
descriptions, but I would not do anything more beyond that.

^(1)^ {{Thread.sleep}} is almost always a bad idea. Could that maybe explain 
MCLEAN-102? In this case in particular, it looks like a random hack - what 
problem where they even trying to fix? But anyway, that is out of scope here.


was (Author: peterdm):
The stack trace is coming from {{Cleaner.delete:300}}, which is not Java code. 
There is no Java exception there. There are multiple complications there: on 
Windows or not, retries with {{Thread.sleep}}{^}(1)^ and back-off delays.

This issue is missing a concrete situation illustrating an actual lack of 
information. Java's own {{File.delete}} API, which is used underneath, doesn't 
give more accurate information either besides {{true}} "delete successful" or 
{{false}} "delete unsuccessful". We could migrate to Java 7's improved 
{{Files.delete}} API, which instead throws exceptions with more accurate 
descriptions, but I would not do anything more beyond that.

^(1)^ {{Thread.sleep}} is almost always a bad idea. Could that maybe explain 
MCLEAN-102? In this case in particular, it looks like a random hack - what 
problem where they even trying to fix? But anyway, that is out of scope here.

> Provide more accurate reason when can not delete a resource
> -----------------------------------------------------------
>
>                 Key: MCLEAN-124
>                 URL: https://issues.apache.org/jira/browse/MCLEAN-124
>             Project: Maven Clean Plugin
>          Issue Type: Improvement
>            Reporter: Slawomir Jaranowski
>            Priority: Major
>
> Currently we have only in stack trace something like:
> {noformat}
> Caused by: java.io.IOException: Failed to delete 
> /Users/runner/work/maven-surefire/maven-surefire/surefire-its/target
>     at org.apache.maven.plugins.clean.Cleaner.delete (Cleaner.java:300)
>     at org.apache.maven.plugins.clean.Cleaner.delete (Cleaner.java:250)
>     at org.apache.maven.plugins.clean.Cleaner.delete (Cleaner.java:124)
> {noformat}
> It will be usable if we have reported a reason ... why can not be deleted



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to