jGuru
Register Email     Password Forgot your
password?
HOME FAQS FORUMS DOWNLOADS ARTICLES PEERSCOPE LEARN

  Search   jGuru Search Help

Question How to make ANT keep source line numbers When I build with ANT 1.3, exceptions show source code line numbers. For example:

java.lang.Exception: com.ge.med.gemsit.rs.dise.app_server_not_available
at com.ge.med.gemsit.rs.dise.DiseServer.initialize(DiseServer.java:442)
at com.ge.med.gemsit.rs.dise.DiseServer.startServer(DiseServer.java:833)
at com.ge.med.gemsit.rs.dise.DiseServer.main(DiseServer.java:1630)

However, when I switch to ANT 1.5 or ANT 1.5.4, exceptions look like:

java.lang.Exception: com.ge.med.gemsit.rs.dise.app_server_not_available
at com.ge.med.gemsit.rs.dise.DiseServer.initialize(Unknown Source)
at com.ge.med.gemsit.rs.dise.DiseServer.startServer(Unknown Source)
at com.ge.med.gemsit.rs.dise.DiseServer.main(Unknown Source)

The build environment is not changed except for ANT_HOME and PATH to ant script.

The javac task only has srcdir, destdir, excludes attributes plus the classpath and include nested tags. Do I miss something? Thank you.

Derived from A question posed by Jeff Chu
Topics Tools:Build:Ant
Author Eugene Kuleshov PREMIUM
Created Oct 17, 2003


Answer
You should turn it on like this:
  <javac srcdir="src" destdir="target/classes"
         debug="true" debuglevel="lines, vars, and source">
    ...

  </javac>


Is this item helpful?  yes  no     Previous votes   Yes: 6  No: 0



Comments and alternative answers

Comment on this FAQ entry

Point of clarification
Bill Wadley, Oct 19, 2003
The debuglevel above should read:

debuglevel="lines, vars, source"

The "and" is from to ant docs.

Is this item helpful?  yes  no     Previous votes   Yes: 2  No: 0



Reply to this answer/comment  Help  
Cause compile with "debug"
Scott Green, Dec 19, 2003
Does this cause the debug flag to be added to the compile so the files are bigger in size ?

Is this item helpful?  yes  no     Previous votes   Yes: 0  No: 0



Reply to this answer/comment  Help  
debuglevel in ant
dieter v. holten, Jan 7, 2004  [replies:3]
i would say, for that purpose debuglevel="lines, source" should be enough - local variable info is needed only for debugger

Is this item helpful?  yes  no     Previous votes   Yes: 0  No: 0



Reply to this answer/comment  Help  
Re: debuglevel in ant
Eric Schlenz, Apr 13, 2004  [replies:2]
JUST FYI!!!

I only got this to work when my debuglevel setting looked like this:

debuglevel="lines,vars,source"

NO SPACES between the debuglevel values).

Is this item helpful?  yes  no     Previous votes   Yes: 4  No: 0



Reply to this answer/comment  Help  
Re[2]: debuglevel in ant
Elton Sanchez, Jan 23, 2006
What about when using JAR libraries? Can I get line specific call stack dumps when the code dies in a class in the JAR file?

Part of my call stack winds through a JAR I had made earlier using Ant, exactly where my runtime errors are originating from. Having exact lines would help cut down my work.

Is this item helpful?  yes  no     Previous votes   Yes: 0  No: 0



Reply to this answer/comment  Help  

Re[2]: debuglevel in ant
Steven Kuypers, Mar 11, 2010
Thanks to all!
adding debug="true" debuglevel="lines,source" (indeed without a space between 'lines,' and 'source') in the <javac> tag solved the problem of missing line numbers.

Without it I would see
package.class(?:?) - message

and now I see
package.class(blabla.java:147) - message

Keywords: log4J missing class missing line number

Is this item helpful?  yes  no     Previous votes   Yes: 0  No: 0



Reply to this answer/comment  Help  


Ask A Question



 
Related Links

Ant FAQ

Ant Forum

Ant Homepage

Sun: Best Practices

Hatcher Ant Book

Hatcher Ant Book

Automate your build process using Java and Ant

Wish List
Features
About jGuru
Contact Us

 


Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers