ant warning: “'includeantruntime' was not set”

前端 未结 7 1107
眼角桃花
眼角桃花 2020-12-04 05:00

I receive the following warning:

[javac] build.xml:9: warning: \'includeantruntime\' was not set, 
defaulting to build.sysclasspath=last; set to false for re         


        
相关标签:
7条回答
  • 2020-12-04 05:22

    The answer from Daniel works just perfect. Here is a sample snippet that I added to my build.xml:

    <target name="compile">
        <mkdir dir="${classes.dir}"/>
        <javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false">
                                                     <!--   ^^^^^^^^^^^^^^^^^^^^^^^^^  -->
            <classpath>
                <path id="application" location="${jar.dir}/${ant.project.name}.jar"/>
                <path id="junit" location="${lib.dir}/junit-4.9b2.jar"/>
            </classpath>
        </javac>
    </target>
    
    0 讨论(0)
  • 2020-12-04 05:29

    Ant Runtime

    Simply set includeantruntime="false":

    <javac includeantruntime="false" ...>...</javac>
    

    If you have to use the javac-task multiple times you might want to consider using PreSetDef to define your own javac-task that always sets includeantruntime="false".

    Additional Details

    From http://www.coderanch.com/t/503097/tools/warning-includeantruntime-was-not-set:

    That's caused by a misfeature introduced in Ant 1.8. Just add an attribute of that name to the javac task, set it to false, and forget it ever happened.

    From http://ant.apache.org/manual/Tasks/javac.html:

    Whether to include the Ant run-time libraries in the classpath; defaults to yes, unless build.sysclasspath is set. It is usually best to set this to false so the script's behavior is not sensitive to the environment in which it is run.

    0 讨论(0)
  • 2020-12-04 05:30

    If you like me work from commandline the quick answer is executing

    export ANT_OPTS=-Dbuild.sysclasspath=ignore
    

    And then run your ant script again.

    0 讨论(0)
  • 2020-12-04 05:32

    Chet Hosey wrote a nice explanation here:

    Historically, Ant always included its own runtime in the classpath made available to the javac task. So any libraries included with Ant, and any libraries available to ant, are automatically in your build's classpath whether you like it or not.

    It was decided that this probably wasn't what most people wanted. So now there's an option for it.

    If you choose "true" (for includeantruntime), then at least you know that your build classpath will include the Ant runtime. If you choose "false" then you are accepting the fact that the build behavior will change between older versions and 1.8+.

    As annoyed as you are to see this warning, you'd be even less happy if your builds broke entirely. Keeping this default behavior allows unmodified build files to work consistently between versions of Ant.

    0 讨论(0)
  • 2020-12-04 05:35

    i faced this same, i check in in program and feature. there was an update has install for jdk1.8 which is not compatible with my old setting(jdk1.6.0) for ant in eclipse. I install that update. right now, my ant project is build success.

    Try it, hope this will be helpful.

    0 讨论(0)
  • 2020-12-04 05:43

    Use <property name="build.sysclasspath" value="last"/> in your build.xml file

    For more details search includeAntRuntime in Ant javac

    Other possible values could be found here

    0 讨论(0)
提交回复
热议问题