Reference not found

Hi, I am migrating from Ant to Gradle.

The old build do not have a common LIB folder for all jars. So, the Ant build had several path variables which were later used as per requirement. Ex:

<path id="xyz.lib">
  <fileset dir="someDir">
   <include name="*.jar" />
  </fileset>
</path>

there are other similar variables.

Now far a particular compile task, the classpathref is set to one of these variables. This works in Ant.

Gardle: I converted each path variable into

def xyz_lib = ant.path{
                              fileset(dir:"someDir",includes:"*.jar")
                    }

and later used this attribute in

ant.javac(....,classpathref=xyz_lib,...)

But during compilation, the build throws “reference jars not found” error.

Can you please guide me what is wrong?

Thanks and Regards, Nishant.

FYI:

I have also tried by defining path as

ant.path(id: 'xyz_lib'){
fileset(dir:"someDir",includes:"*.jar")

and then in ant.javac

ant.javac(....., classpathref = ant.references['xyz_lib'] ,.....)