commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <>
Subject [Jelly] How to do this?
Date Fri, 08 Nov 2002 18:07:16 GMT

I'd like to be able to pass a list of classnames to the junit swing test
runner. These classnames should be extracted from names of files in the
file system.

Something like:

<fileScanner var="batchscanner">
  <fileset dir="${maven.cactus.src.dir}" includes="**/*.java"/>

      <j:forEach var="test" items="${batchscanner.iterator()}">
        <j:set var="length" value="${test.getPath().length() - 5}"/>

<java classname="junit.swingui.TestRunner" fork="true" dir="${basedir}">
  <j:forEach var="test" items="${batchscanner.iterator()}">
    <j:set var="classname" value="${test.getPath().substring(0,
test.getPath().length() - '.java'.length())}"/>
    <arg line="${classname}"/>


I have 2 problems. 

The first one is that "${test.getPath().substring(0,
test.getPath().length() - '.java'.length())} does not properly evaluate.
I thought that everything inside ${} was a java expression, but
apparently it isn't so. The problem seems to be that the second
"test.getPath().length()" does not yield the expected result.

The second one is that the FileScanner is creating a File Object from an
Ant DirectoryScanner by doing the following: new File( ds.getBasedir(),
files[fileIndex] );

Thus, the path that I get from ${tests.getPath()} are absolute paths
whereas I would need relative ones. Alternatively I need to be able to
remove the absolute part. I would then need something like:


but obviously this would not work.

I could do all that from a java jelly tag, but I was wondering whether
there was not an easy jelly solution (maybe scripts? Or even simpler) to
the problem?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message