Question

I have ant build script that compiles and generates the compilation logs(in file compileLog.xml) of my project. I use jdtCompileLogPublisher to publish these results the RTC.

Now the situation is when i have the sources in the project its working fine. When i don't have any sources in the project(this is a one of the requirement that there will be an empty project with out sources), compilation step is skipped as there are no sources,and jdtCompileLogPublisher is failing because, the file compileLog.xml which is an input for this step is not created as compilation itself has been skipped.

I tried creating a new compileLog.xml if it is not available. As a result of this I'm encountering new issues as file is empty.

  1. Why javac is skipped when there are no java files to compile?
  2. Is there any possibility to make the compiler to execute javac in build.xml

Version ant: 1.7.1.

snippet of my code related to :

<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>
Was it helpful?

Solution

I modified the tag
<jdtCompileLogPublisher buildResultUUID="${buildInfo.buildResultUUID}" repositoryAddress="${repositoryAddress}" userId="${userId}" passwordFile="${psFile}" filePath="compileLog.xml" />
to
<jdtCompileLogPublisher buildResultUUID="${buildInfo.buildResultUUID}" repositoryAddress="${repositoryAddress}" userId="${userId}" passwordFile="${psFile}" filePath="compileLog.xml" failonerror="false" />
Which solved my problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top