Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line number info not available error while debugging Ant project in IntelliJ

I am working with a fairly old Java Ant project, which I have imported into IntelliJ, it previously having been developed using Eclipse. The project consists of a small number of servlets. I am trying to debug from IntelliJ. IntelliJ can connect to remote Tomcat on port 8000, but when I try to add a breakpoint I get the following dreaded error:

Line numbers info is not available in class com.package.blah.SomeClass

Following advice on SO and elsewhere, I modified my Ant build script to the following:

<target name="compile" depends="web-skeleton">
    <ant dir="${deployment-wizard.dir}" target="uberjar"/>
    <javac debug="true" debuglevel="lines,vars,source" srcdir="${src.dir}"
        destdir="${build.dir}/WEB-INF/classes" classpathref="project.class.path"/>
</target>

I added the debug and debuglevel lines to the above target which calls javac. Also, I have tried running javap -v SomeClass.class, where I see things like the following:

  line 94: 418
  line 97: 433
  line 98: 443
LocalVariableTable:
  Start  Length  Slot  Name   Signature
    343      22    13 decrypted   Ljava/lang/String;
    370      11    13     e   Ljava/lang/Exception;
    244     189     7 keyParam   Ljava/lang/String;
    255     178     8 userParam   Ljava/lang/String;
    266     167     9 environmentParam   Ljava/lang/String;

I don't know if this means that the bytecode contains line numbers, but it certainly appears this way.

I have also tried cleaning and rebuilding from scratch and doing an invalidate caches/restart from IntelliJ.

I hope that someone can offer some help here. As a last resort, I can try porting it to a Maven project, but I would prefer to avoid this unless absolutely necessary.

like image 478
Tim Biegeleisen Avatar asked Apr 20 '18 04:04

Tim Biegeleisen


1 Answers

the same thing happened to me and it was because I had "shrinkResources true" and "minifyEnabled true" in Gradle App

buildTypes { debug { shrinkResources false minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }

like image 136
user2029905 Avatar answered Oct 02 '22 11:10

user2029905