empty <excludes/> removes the directory of the fileset
------------------------------------------------------

         Key: MCLEAN-7
         URL: http://jira.codehaus.org/browse/MCLEAN-7
     Project: Maven 2.x Clean Plugin
        Type: Bug

    Reporter: Jesse McConnell


I was shifting the unit tests over to use the plugin harness and noticed a test 
case failing.

if you look at the test case for the fileset test case, the second fileset test 
has an addFileset(dir, "**", "");

this unit test works fine, but when you try and actually do this behavior using 
the plugin configuration it brings up an error

            <fileset>
              
<directory>${basedir}/target/test-classes/fileset-clean-test/buildOutputDirectory</directory>
              <includes>
                <include>**</include>
              </includes>
            </fileset>

that would be the plugin configuration of the same deal.  (<exclude></exclude> 
results in a stack trace)

In this case the directory is getting deleted when configured.  You can exhibit 
the same behavior with the existing test case if you try and pass null into the 
addFileset signature...


this would be the failing test case using the existing plugin, note the null in 
the second addFileset()
------

 public void testFilesets()
        throws Exception
    {
        String base = TARGET_TEST_DIR + "/target";

        CleanMojo mojo = new CleanMojo();

        mojo.addFileset( createFileset( base, "**/file.txt", "**/subdir/**" ) );

        String outputDirectory = TARGET_TEST_DIR + "/buildOutputDirectory";
        mojo.addFileset( createFileset( outputDirectory, "**", null ) );

        mojo.execute();

        // fileset 1
        assertTrue( checkExists( base ) );
        assertTrue( checkExists( base + "/classes" ) );
        assertFalse( checkExists( base + "/classes/file.txt" ) );
/* TODO: looks like a bug in the file-management library
        assertTrue( FileUtils.fileExists( base + "/subdir/file.txt" ) );
*/

        // fileset 2
        assertTrue( checkExists( outputDirectory ) );
        assertFalse( checkExists( outputDirectory + "/file.txt" ) );
        System.exit(-1);
    }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to