This actually does what I want: <?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="t" basedir="."> <path id="p"> <fileset dir="a"/> <fileset dir="b"/> </path> <target name="t"> <javac srcdir="." sourcepathref="p"/> </target> </project> The problem is that I don’t really want to specify srcdir, but if I leave it out, the build fails (see below). I would need to create a fake directory to use as srcdir to be sure that I don’t accidentally compile unwanted sources. Apache Ant(TM) version 1.10.14 compiled on August 16 2023 Trying the default build file: build.xml Buildfile: /Users/alan/testAnt1/build.xml Detected Java version: 21 in: /Library/Java/JavaVirtualMachines/jdk-21.0.1.jdk/Contents/Home Detected OS: Mac OS X parsing buildfile /Users/alan/testAnt1/build.xml with URI = file:/Users/alan/testAnt1/build.xml Project base dir set to: /Users/alan/testAnt1 parsing buildfile jar:file:/Users/alan/.ant/lib/vbuilder-ant-uber-1.0-SNAPSHOT.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/Users/alan/.ant/lib/vbuilder-ant-uber-1.0-SNAPSHOT.jar!/org/apache/tools/ant/antlib.xml from a zip file parsing buildfile jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/local/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file Build sequence for target(s) `t' is [t] Complete build sequence is [t, ] t: BUILD FAILED /Users/alan/testAnt1/build.xml:11: either srcdir or modulesourcepath attribute must be set! at org.apache.tools.ant.taskdefs.Javac.checkParameters(Javac.java:1309) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1080) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99) at org.apache.tools.ant.Task.perform(Task.java:350) at org.apache.tools.ant.Target.execute(Target.java:449) at org.apache.tools.ant.Target.performTasks(Target.java:470) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401) at org.apache.tools.ant.Project.executeTarget(Project.java:1374) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1264) at org.apache.tools.ant.Main.runBuild(Main.java:818) at org.apache.tools.ant.Main.startAnt(Main.java:223) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101) Total time: 0 seconds > On Dec 19, 2023, at 10:17 PM, Jaikiran Pai <jaiki...@apache.org> wrote: > > Hello Alan, > > It's hard to say what's going on. Do you have a build file (or a snippet) to > show what issue you are running into? > > Which version of Java and Ant is this showing up on? > > -Jaikiran > > On 18/12/23 1:44 am, Alan Snyder wrote: >> I know of a couple of ways to run javac on more than one source tree. >> >> One way is to use nested src elements. >> >> Another way is like this: >> >> srcdir="${src}:${src2}” >> >> I would like to generalize this solution to a dynamicly determined list of >> source trees. >> >> I thought that I could use srcpath for this purpose, but the task would fail >> if srcdir was not specified or it did not identify a valid directory. >> That restriction defeats my purpose. >> >> Is there a solution? >> >> Is the inability to use srcpath by itself a bug? >> >> Thank you. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org >> For additional commands, e-mail: user-h...@ant.apache.org >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org >