We have a big development project with approximately 15000 - 20000 java
source objects which we regularly are compiling in our CI environment to
determine dependency errors (mainly outbound dependency problem). Our
problem is to get the javac process going even if we find a compile error.

We have tested to run the javac task within a ant contrib trycatch block
(see below), but this is failing as we have dependency between java objects
in the same package and the compiler can not determine these dependency when
we feed the compiler object by object, so now we need to find some other way
to handle errors without breaking the compile process but still we like the
full process to fail if we run in to any error.

I do appreciate all suggestions on how to handle this

Our test with trycatch

<?xml version="1.0" encoding="UTF-8"?> 
<project name="Copille-dbDef" default="cmp-def"
xmlns:ac="antlib:net.sf.antcontrib"> 
        
  <path id="build.class.path"> 
        <fileset dir="${proj.externals.dir}/FND"> 
                <include name="**/*.jar"/> 
        </fileset> 
        <pathelement path="${proj.bin.dir}/${be.component}/bindbg"/> 
        <pathelement path="${base.root}"/> 
  </path> 
  <target name="cmp-def" description="Compilling DB Def"> 
        <pathconvert property="build.classpath.prop"
refid="build.class.path" targetos="windows" /> 
        <echo message="Current classpath: ${build.classpath.prop}"/> 

        <ac:for param="obj"> 
             <path> 
                <fileset
dir="${proj.src.dir}/${be.component}/src/mvx/db/def"> 
                        <include name="**/*.java"/> 
                </fileset> 
             </path> 

             <sequential> 
                <ac:propertyregex override="yes" 
                property="obj" input="@{obj}" 
                     regexp="(.+\\)(.+\.java)" 
                     replace="\2" 
                          casesensitive="false" /> 
                                
             <ac:trycatch property="exception.message"
reference="exception.ref"> 
                <ac:try> 
                           <javac taskname="compile.def" 
                        sourcepath="" 
                       
srcdir="${proj.src.dir}/${be.component}/src/mvx/db/def" 
                        destdir="${proj.bin.dir}/${be.component}/bindbg" 
                        includes="${obj}" 
                        classpathref="build.class.path" 
                        compiler="org.eclipse.jdt.core.JDTCompilerAdapter" 
                        target="1.6" 
                        source="1.6" 
                        debug="on" 
                        failonerror="true" 
                        fork="no" 
                           /> 
                </ac:try> 
                <ac:catch> 
                        <echo message="Compile error on: ${obj}  Error
message:       
                                       
${exception.message}${line.separator}" 
                          file="${ProjBaseDir}\Compille.error" 
                          append="true" level="warning" 
                                       /> 
                </ac:catch> 
        </ac:trycatch> 
    </sequential> 
  </ac:for> 
</target> 
</project>
-- 
View this message in context: 
http://www.nabble.com/dealing-with-compile-errors-in-javac-tp22106285p22106285.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to