简体   繁体   中英

How to mention -profile in ant <javac> JDK8

I want to compile my java code in JDK8 "compact profile 2". How to mention this "-profile" in task. I am using apache ant 1.9.2. I tried to execute this below written target, but it failed saying 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>

The -profile option, along with other javac command options, can be specified using the nested compilerarg element:

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM