我有ant編譯腳本,編譯並生成我的項目的編譯日誌(在文件compileLog.xml中)。我使用jdtCompileLogPublisher將這些結果發佈到RTC。jdtCompileLogPublisher javac
現在的情況是,當我在項目中的來源工作正常。當我在項目中沒有任何源代碼時(這是一個需要使用外部源的空項目),編譯步驟會跳過,因爲沒有源代碼,並且jdtCompileLogPublisher失敗,因爲文件compileLog作爲該步驟的輸入的.xml不會被創建,因爲編譯本身已被跳過。
我試着創建一個新的compileLog.xml文件,如果它不可用。由於這個文件是空的,我遇到了新的問題。
- 爲什麼javac在沒有java文件編譯時被跳過?
- 是否有可能使編譯器build.xml中
版螞蟻執行的javac:1.7.1。
片斷的我的代碼涉及到:
<target name="compile" depends="prepare" description="Compile the source code">
<mkdir dir="${nameBuild}/${dir.build}/bin" />
<!-- Add target ${label.jdkversion} to make it possible to build with a certain jdk version-->
<javac compiler="org.eclipse.jdt.core.JDTCompilerAdapter" destdir="${nameBuild}/${dir.build}/bin" debug="true" deprecation="on" encoding="ISO-8859-1" source="${buildInfo.jdkVersion}" target="${buildInfo.jdkVersion}" debuglevel="lines,source" failonerror="false" errorProperty="buildFailed">
<compilerarg line="-warn:+raw" />
<compilerarg line="-warn:-serial" />
<compilerarg line="-enableJavadoc" />
<compilerarg line="-log source/${name}/compileLog.xml" />
<src path="${name}/${dir.src}" />
<classpath refid="application.classpath" />
</javac>
<jdtCompileLogPublisher buildResultUUID="${buildInfo.buildResultUUID}" repositoryAddress="${repositoryAddress}" userId="${userId}" passwordFile="${psFile}" filePath="compileLog.xml" />
<fail if="buildFailed" message="Compile ${name} failed." />
</target>