javadebuggingantjavacdebug-information

Ant arror on upgrade to jdk version 7


I have a ant script which ran successfully with jdk version 6.

<javac srcdir="${top}/src" destdir="${clientclasses}" debug="true"
        debuglevel="line" verbose="true" listfiles="true" target="1.5"
        source="1.5"
        includes="client/*.java, common/ApplicationConstants.java">
        <classpath>
            <path path="${output}"/>
            <path refid="classpath_for_src_dir_compile"/>
        </classpath>
    </javac>

But when I upgraded jdk version to 7, it started giving error saying,

-g:line invalid argument to javac

I removed debuglevel=line and ant script works fine. But I want to keep old behaviour, Is there something java 7 has changed and I need to modify accordingly?


Solution

  • Try to replace debuglevel="line" with correct option debuglevel="lines".

    It seems Java 6 just ignored incrorrect "line" param and used default "sources, lines, and vars" while Java 7 learned to complain.

    You may need just to remove debuglevel tag to retain complete debug info as it was before.

    See Enabling javac debugging for Apache ANT.