ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Wolfe" <greg.wo...@MyPoints.com>
Subject RE: 'java' ant task not displaying debug info
Date Wed, 07 Apr 2004 20:13:42 GMT
Matt,

Your suggestion did not fix the problem.
(Note: I assume that you actually meant
'add <sysproperty key="java.compiler" value="NONE" />
to the java task')

Can you try running my example in your environment?
It would be helpful to isolate whether this problem
is general or specific to my environment.

(
$ ant -version
Apache Ant version 1.5.2-23 compiled on November 12 2003
$ java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b04)
Java HotSpot(TM) Client VM (build 1.4.2_04-b04, mixed mode)
)

Thanks,
-Greg Wolfe


--- Matt Benson wrote:

I actually meant to respond to your first query...
This is probably the JIT.  You're already forking the
JVM, but try to add a <sysproperty
name="java.compiler" value="NONE" />

-Matt

--- Greg Wolfe wrote:
> I've posted on this before, but got no response so
> I've devised a simple test case that demonstrates
> the problem.
> 
> When I compile with the 'javac' task in ant with
> 'debug' set to true, debug information is in the
> class file which is produced.  I can verify this by
> running 'java' from the command line.  However, when
> I run the 'java' ant task, debug information is not
> shown.  I'm running ant version 1.5.2-23
> 
> I would appreciate it if people can try out this
> program and report if they get the same result.
> 
> Thanks,
> -Greg Wolfe
> 
> ----
> running from ant:
> 
> $ ant
> Buildfile: build.xml
>  
> init:
>     [mkdir] Created dir:
> /home/gwolfe/msrc/emp/sample/build
>  
> build:
>     [javac] Compiling 1 source file to
> /home/gwolfe/msrc/emp/sample/build
>  
> run:
>      [java] Example String
>      [java] Exception in thread "main"
> java.lang.Exception: This exception should log the
> line number
>      [java]    at Example.main(java.lang.String[])
> (Unknown Source)
>      [java] Java Result: 1
>  
> BUILD SUCCESSFUL
> Total time: 0 seconds
> 
> 
> ==> note the "Unknown Source" in the output.
> 
> running java from the commandline:
> $ cd build; java Example; cd ..
> Example String
> Exception in thread "main" java.lang.Exception: This
> exception should log the line number
>         at Example.main(Example.java:15)
> 
> ==> note that debug information is available
> 
> 
> ---
> src/Example.java:
> /**
>  * Demo program to check if debug is enabled
>  * @author Greg Wolfe
>  */
>                                                     
>                            
> public class Example {
>     public Example(String message) {
>         this._message = message;
>     }
>                                                     
>                            
>     public String getMessage() {
>         return _message;
>     }
>     public static void main(String[] args) throws
> Exception {
>         System.out.println(new Example("Example
> String").getMessage());
>         throw new Exception("This exception should
> log the line number");
>     }
>                                                     
>                            
>     private String _message;
> }
>                                                     
>                            
> 
> build.xml:
> <project name="CompileErrorDemo" default="run"
> basedir=".">
>   <description>
>     Demonstrate the lack of debug information in a
> case where it
>     should be present.
>   </description>
>                                                     
>                                                     
>                           
>   <!-- properties that should not be changed -->
>                                                     
>                                                     
>                           
>   <property name="src"        location="src"/>
>   <property name="build"      location="build"/>
>                                                     
>                                                     
>                           
>   <target name="init">
>     <mkdir dir="${build}"/>
>   </target>
>                                                     
>                                                     
>                           
>   <target name="build" depends="init"
> description="compile the source ">
>     <javac debug="true" debuglevel="lines, source"
> srcdir="${src}" destdir="${build}" >
>       <src>
>         <pathelement path="${src}" />
>       </src>
>     </javac>
>   </target>
>                                                     
>                                                     
>                           
>   <target name="run" depends="build"
>        description="run the compiled code">
>     <java classname="Example" fork="true">
>       <classpath>
>         <pathelement path="${build}"/>
>       </classpath>
>     </java>
>   </target>
>                                                     
>                                                     
>                           
>   <target name="clean" description="clean out the
> output directories" >
>     <delete dir="${build}"/>
>   </target>
>                                                     
>                                                     
>                           
> </project>
> 





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message