下面的ant
compile
目标会编译使用.java
标记指定的任何src
文件夹中的所有<src path="..."/>
个文件。我的问题是关于编译的顺序。 ant
首先编译第一个src
标记引用的文件(即首先编译${xtext.project.path}/src
中的Java文件),然后编译第二个src
标记等?编译文件的顺序是什么?我试图找出文件夹之间的依赖关系,并想知道它们列出的顺序是否告诉我任何事情。
<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>
答案 0 :(得分:1)
您可以通过使用<javac>
选项运行Ant来查看-verbose
如何编译文件。
例如,以下Ant脚本......
<javac debug="true" includeantruntime="false">
<src path="src1"/>
<src path="src2"/>
</javac>
...在Windows机器上运行ant -verbose
输出以下内容...
[javac] Compilation arguments:
[javac] '-classpath'
[javac] ''
[javac] '-sourcepath'
[javac] '.....\src1;.....\src2'
[javac] '-g'
在上面的示例中,Ant将<src>
元素组合成以分号分隔的-sourcepath
参数。
-sourcepath
是Oracle's javac
tool的选项:
-sourcepath sourcepath
指定搜索类或接口定义的源代码路径。与用户类路径一样,源路径条目由Oracle Solaris上的冒号(:)和Windows上的分号分隔,可以是目录,JAR存档或ZIP存档。
请注意Ant <javac>
任务与Oracle javac
工具之间的区别。 Ant <javac>
任务调用Oracle javac
工具。
对于你的问题“编译文件的顺序是什么?”,答案基本上是:Java文件都是同时编译的。