[ http://jira.codehaus.org/browse/MCLEAN-7?page=comments#action_61804 ]
Jesse McConnell commented on MCLEAN-7:
--------------------------------------
Not sure what to do here...
the original test case used the "**" includes and "" excludes which exhibited
the desired behavior...
Now it would seem to me that
<fileset>
<includes>
<include>**</include>
</includes>
</fileset>
now to me that would be the same thing, but DirectoryScanner specificaly looks
for "" in the exclude to decide if the directory should be deleted.
<fileset>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude></exclude>
</excludes>
</fileset>
Now this builds an excludes arraylist of size 1 but null inside, which triggers
a NPE in DirectoryScanner..
<fileset>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>""</exclude>
</excludes>
</fileset>
This certainly doesn't work since it translate to "\"\"" in the fileset
BUT!
<fileset>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**</exclude>
</excludes>
</fileset>
does exhibit the correct behavior, since the includes ** matchs the files in
the directory and the ** actually seems to protect the directory. The files
end up getting smoked but the base directory of the fileset is perserved.
This seems a bit off to me, but I am able to configure a fileset that exhibits
the same end behavior of the test case...but this feels like another issue to
me, that ** in includes means something other then ** in excludes.
> 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