You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kelly Davis <kd...@pobox.com> on 2004/10/14 23:26:16 UTC
ant task output file differs in API from command line usage
I have the following code which executes a build file:
Project project = new Project();
project.init();
project.setUserProperty( "base.dir", new File( rootDir
).getAbsolutePath() );
project.setUserProperty( "ant.file", new File( new File( rootDir ),
buildFile ).getAbsolutePath() );
project.setProperty( "build.properties", propertyFile );
ProjectHelper helper = ProjectHelper.getProjectHelper();
helper.parse( project, new File( new File( rootDir), buildFile ));
project.executeTarget( "build" );
The build file uses the 'ant' task to execute a sub-project build, which
simply compiles some code. The 'ouput' option is used to write the
output of the sub-project build to a file. When the above code executes,
I get the following in the output file:
prepare:
compile:
[javac] Compiling 611 source files to
/usr/local/builder/work/core/modules/work/core/classes
The problem with this is there is no indication of a compiler error
which is occurring. Now, if I execute the exact same build file from the
command line (with no api), this is what ends up in the output file:
prepare:
compile:
[javac] Compiling 611 source files to
/usr/local/builder/work/core/modules/work/core/classes
[javac]
/usr/local/builder/work/core/modules/core/src/java/com/pensare/sys/KCSystem.java:45:
repeated modifier
[javac] public static final String SYSTEM_PROPERTIES =
"system.props";
[javac] ^
[javac] 1 error
[javac] 6 warnings
Why am I not getting the compile error in the output file when I run the
build script using the API?
Thanks, Kelly
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: ant task output file differs in API from command line usage
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Kelly Davis wrote:
> Would you be able to offer any detailed instructions on accomplishing this. I
> have tried to redirect the output streams of a DefaultLogger to a file, but
> this still doesn't give the compile errors in the subproject.
>
The best place to start is to look at Main.java to see where it sets up
the DemuxOutputStreams (in the runBuild() method). If you can take
control of System.out and System.err in your environment, then you can
use the same approach.
Conor
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: ant task output file differs in API from command line usage
Posted by Kelly Davis <kl...@duke.edu>.
Would you be able to offer any detailed instructions on accomplishing this. I
have tried to redirect the output streams of a DefaultLogger to a file, but
this still doesn't give the compile errors in the subproject.
Quoting Conor MacNeill <co...@cortexebusiness.com.au>:
> >
> > Why am I not getting the compile error in the output file when I run the
> > build script using the API?
> >
>
> because you have not redirected System.out and System.err. I have a blog
> entry with a bit of info on this -
>
> http://codefeed.com/blog/archives/000068.html
>
> Conor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: ant task output file differs in API from command line usage
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
>
> Why am I not getting the compile error in the output file when I run the
> build script using the API?
>
because you have not redirected System.out and System.err. I have a blog
entry with a bit of info on this -
http://codefeed.com/blog/archives/000068.html
Conor
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org