ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Furingstad <k...@furingstad.nu>
Subject Manage compile errors in <javac>
Date Fri, 20 Feb 2009 13:03:41 GMT

Hi

We are creating a CI process for a large java projects with an estimated
15-20-thousand java object. It is crucial for the process that we find and
report all Compile errors at each build, the problem is that we cant figure
this out with ANT's javac task as we cant catch each error without stoping
the entire build process via javac's "failonerror" flag. 

We have tried to use Ant Contribs trycatch task in a for loop but then the
compiler fails to sort out dependencies within a package in that we feed the
compiler with individual object. 

Do any of you have knowledge of  an extended javac task from which we can
catch compile errors in a exception reference or property or can we use the
ant Contribs tryctach in a smarter way than what we have done in our example
below.

I attach our trycatch script:

<?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/Manage-compile-errors-in-%3Cjavac%3E-tp22120102p22120102.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message