问题
The ant compile target below compiles all .java files in any of the src folders specified using a <src path="..."/>
tag. You can see that a number of items are added to the classpath
using <classpath refid=...>
tags.
<target name="compile">
<echo message="${ant.project.name}: ${ant.file}"/>
<deps-load-path conf="core" pathid="core.ivy.classpath" />
<deps-load-path conf="test" pathid="test.ivy.classpath" />
<javac debug="true" includeantruntime="false" debuglevel="source,lines,vars" destdir="${bin.path}" source="1.8" target="1.8">
<src path="${xtext.project.path}/src"/>
<src path="${xtext.project.path}/src-gen"/>
<src path="${project.path}/src"/>
<src path="${project.path}/src-gen-umpletl"/>
<src path="${project.path}/src-gen-umple"/>
<src path="${project.path}/test"/>
<src path="${vendors.path}/jopt-simple/src"/>
<exclude name="**/.git"/>
<exclude name="**/*.ump" />
<exclude name="**/data" />
<classpath refid="project.classpath"/>
<classpath refid="validator.project.classpath"/>
<classpath refid="core.ivy.classpath" />
<classpath refid="test.ivy.classpath" />
<!-- Add compiler arguments here, see https://ant.apache.org/manual/using.html#arg for details, example below
<compilerarg value="-Xlint:deprecation" />
-->
</javac>
<copy todir="${bin.path}" overwrite="true">
<fileset dir="${project.path}/src"><include name="**/*.grammar"/></fileset>
<fileset dir="${project.path}/src"><include name="**/*.error"/></fileset>
</copy>
<delete file="cruise.umple/src/rules.grammar"/>
<delete file="cruise.umple/bin/rules.grammar"/>
</target>
One of these items is project.classpath
, which is defined elsewhere in the file as the same location as ${bin.path}
, which is where the compiled files are written to (see the <copy todir...>
tag). How can ${bin.path}
be both a classpath dependency and the location where .class
files are written to? I know for a fact that ${bin.path}
gets deleted before each build, so there isn't anything in the folder prior to the compile target being run. Are the .class
files that are produced as the compile target executes added to the classpath dynamically?
来源:https://stackoverflow.com/questions/42913499/classpath-and-ant-builds