You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Furingstad <kl...@furingstad.nu> on 2009/02/20 14:03:41 UTC

Manage compile errors in

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