You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "jira-importer (via GitHub)" <gi...@apache.org> on 2025/02/28 10:41:34 UTC

[I] [MCLEAN-36] filesets with an absolute path directory are ignored when !project.isExecutionRoot() [maven-clean-plugin]

jira-importer opened a new issue, #200:
URL: https://github.com/apache/maven-clean-plugin/issues/200

   **[Will Horn](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=will.horn@gmail.com)** opened **[MCLEAN-36](https://issues.apache.org/jira/browse/MCLEAN-36?redirect=false)** and commented
   
   Due to the fix for http://jira.codehaus.org/browse/MCLEAN-27, mvn clean will not delete a fileset with a directory represented by an absolute path when run from a parent directory.  Instead it will automatically prepend the project directory path to the absolute path and silently do nothing after not find the directory.  The logic responsible is in http://svn.apache.org/viewvc/maven/plugins/tags/maven-clean-plugin-2.2/src/main/java/org/apache/maven/plugin/clean/CleanMojo.java?revision=594869&view=markup
   
                       getLog().info( "Deleting " + fileset );
       
                       if ( !project.isExecutionRoot() )
                       {
                           String projectBasedir = StringUtils.replace( project.getBasedir().getAbsolutePath(), "\\", "/" );
                           String filesetDir = StringUtils.replace( fileset.getDirectory(), "\\", "/" );
       
                           if ( filesetDir.indexOf( projectBasedir ) == -1 )
                           {
                               fileset.setDirectory( projectBasedir + "/" + filesetDir );
                           }
                       }
       
                       fileSetManager.delete( fileset );
   
   The issue can be seen in the attached test project.  If a directory c:\mvntemp exists, then "mvn clean" from the base directory will not delete it.  "mvn clean" from inside subproject will work since project.isExecutionRoot() is true and the above logic is not executed.
   
   
   ---
   
   **Affects:** 2.2
   
   **Attachments:**
   - [mvn-test.zip](https://issues.apache.org/jira/secure/attachment/12714795/mvn-test.zip) (_1.02 kB_)
   
   **Issue Links:**
   - [MCLEAN-30](https://issues.apache.org/jira/browse/MCLEAN-30) Using a parent PoM to clean multiple modules, if one has a clean plugin defined for custom directories, custom directory will not be deleted even though it says it is
   
   - [MCLEAN-27](https://issues.apache.org/jira/browse/MCLEAN-27) fileset directory does not work as expected when cleaning "modules" in sub-directories
   
   - [MCLEAN-31](https://issues.apache.org/jira/browse/MCLEAN-31) Always resolve relative path against the project's base directory
   
   


-- 
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-unsubscribe@maven.apache.org.apache.org

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


Re: [I] [MCLEAN-36] filesets with an absolute path directory are ignored when !project.isExecutionRoot() [maven-clean-plugin]

Posted by "jira-importer (via GitHub)" <gi...@apache.org>.
jira-importer commented on issue #200:
URL: https://github.com/apache/maven-clean-plugin/issues/200#issuecomment-2690314496

   **[Benjamin Bentmann](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=bentmann)** commented
   
   Fixed in [r691788](http://svn.apache.org/viewvc?view=rev&revision=691788), added corresponding test in [r691803](http://svn.apache.org/viewvc?view=rev&revision=691803).
   


-- 
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-unsubscribe@maven.apache.org

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