How to specify -profile in ant <javac> JDK8

I want to compile my Java code in "compact profile 2" JDK8. How to mention this "-profile" in a task. I am using apache ant 1.9.2. I tried this task written below, but didn't realize that javac doesn't support the "profile" attribute . Can anyone help me with this?

<javac destdir="${@{module}.classes.dir}"
               encoding="UTF-8"
               debug="${javac.debug}"
               debuglevel="${javac.debuglevel}"
               optimize="${javac.optimize}"
               deprecation="${javac.deprecation}"
               verbose="${javac.verbose}"
               target="${javac.target}"
               source="${javac.source}"
               profile="compact2"
               listfiles="${javac.listfiles}"
               includeAntRuntime="no"
               includeJavaRuntime="no"
               excludes="${ade.files}, **/package-info.java"
               classpathref="@{module}.classpath.refid">
            <compilerarg line="${javac.warnlevel}" />
            <src refid="@{module}.sourcepath.refid" />
        </java>

      

+3


source to share


1 answer


Parameter -profile

as well as other command parameters javac

can be specified using a nested element compilerarg

:



<javac destdir="${@{module}.classes.dir}"
           encoding="UTF-8"
           debug="${javac.debug}"
           debuglevel="${javac.debuglevel}"
           optimize="${javac.optimize}"
           deprecation="${javac.deprecation}"
           verbose="${javac.verbose}"
           target="${javac.target}"
           source="${javac.source}"
           listfiles="${javac.listfiles}"
           includeAntRuntime="no"
           includeJavaRuntime="no"
           excludes="${ade.files}, **/package-info.java"
           classpathref="@{module}.classpath.refid">
        <compilerarg line="${javac.warnlevel}" />
        <compilerarg line="-profile compact2" />
        <src refid="@{module}.sourcepath.refid" />
</java>

      

+2


source







All Articles