I have a definition for my sourcepath as a path task and wish to use
this in several places in my build, including where I need a fileset
type.  I have several sub projects that are similar so I am trying to
keep the targets generic and parameterize the sub projects as much as
possible.  One of these areas is where the project defines the source
path locations - each sub project has some differences in where the
sources are located, so I have these defined as a path like:

 

<path id="project.sourcepath">

<path location="src" />

<path location="test" />

</path>

 

I can pass project.sourcepath directly to some tasks, like javac, which
is fine, but some other targets such as checkstyle require a fileset. I
thought that using pathtofileset from ant-contrib would solve my
problem, but when I do the conversion the resulting fileset doesn't have
any files in it.

 

<pathtofileset dir="${basedir}" pathrefid="project.sourcepath"
name="project.sourcefileset" />

<checkstyle config="checks.xml">

<fileset refid="project.sourcefileset" /> <!-Problem: doesn't contain
any files! -->

</checkstyle>

 

I would expect that this is a common problem, but can't find a generic
solution.  Ideally I could give the fileset an includes="**/*.java" but
that isn't permitted when using a refid.  

 

Any suggestions on how to get a tree of source files from the source
path?

 

Reply via email to