FileResolver doesn't work

(Mark Maxey) #1

I am stumped on a very basic problem: My sourceSets isn’t being populated because FileResolver isn’t returning what I think it should. I copied AntlrSourceVirtualDirectoryImpl and replaced “.g” with “.xml”:

mpfw = new DefaultSourceDirectorySet(displayName, fileResolver);

Here, fileResolver was created with a

srcDir = "src/main/mpfw"

so that

fileResolver.resolve(srcDir).toString() = "C:\Users\mmaxey\Documents\mpfw\testProjects\src\main\mpfw"

I expected mpfw.getFiles() to return me


but it came back empty.

In the plugin, the “main” sourceSet returns the file correctly. However, if I change the filter above to be


instead of


it still returns the file (even though it shouldn’t).

I must be doing something simply horribly wrong, but what could it be?

(detelinyordanov) #2

Did you forgot to set any srcDir on the SourceDirectorySet by any chance?

(Mark Maxey) #3

The srcDir referenced above is what I printed out as having been set.

(detelinyordanov) #4

You mentioned that fileResolver is created with the printed srcDir, but I was asking about the DefaultSourceDirectorySet’s srcDir property - are you setting that one somewhere?