博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
解决ant编译中出现“includeantruntime was not set”警告的问题
阅读量:6954 次
发布时间:2019-06-27

本文共 2255 字,大约阅读时间需要 7 分钟。

执行ant编译时,总会出现如下的警告:
[javac] D:\SnowPad\build.xml:26: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
虽然不影响编译,但还是解决才安心。其实解决方法也很简单,只需要根据提示在javac任务中添加includeAntRuntime="false"属性即可。例如:
修改前:
    <javac srcdir="${srcDir}" destdir="${binDir}" />
修改后:
    <javac srcdir="${srcDir}" destdir="${binDir}" includeAntRuntime="false" />
注:
1.对于includeAntRuntime属性,官方的解释如下:
    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.
2.此警告在较早的ant版本中可能不会出现,当前用的版本是:Apache Ant(TM) version 1.8.2 compiled on December 20 2010。所以此问题跟ant版本有关。

build.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- one project with multiple targets  -->
<project name="test" default="run" basedir="." >
    <!-- paths used -->
    <property name="src.dir" value="src" />  <!--src代码放在位置 -->
    <property name="dest.dir" value="build" /> <!-- class 生成位置最好建立该文件 -->
    <property name="dest.report" value="report" />
    <path id="jarfile">  <!-- 需要的jar包放进入 -->
        <fileset dir="lib" includes="testng-6.5.1.jar" />
        <fileset dir="lib" includes="selenium-server-standalone-2.49.0.jar"/>
    </path>
    <!-- delete the output folder if it exists -->
    <delete dir="${dest.dir}" failοnerrοr="false" />
    <!-- create the output folder -->
    <mkdir dir="${dest.dir}" />
    <mkdir dir="${dest.report}" />
    <!-- target to compile all test classes out -->
    <target name="build">
        <!-- do copy -->
        <!-- compile -->
        <javac srcdir="${src.dir}" destdir="${dest.dir}" encoding="UTF-8" debug="true" fork="yes"  includeAntRuntime="false" >
            <classpath refid="jarfile"  />
        </javac>
    </target>
    <!-- define the TestNG task -->
    <taskdef name="testng" classname="com.beust.testng.TestNGAntTask" classpathref="jarfile" />
    <!-- run test -->
    <target name="run" depends="build">
        <testng classpathref="jarfile" outputDir="${dest.report}" haltOnFailure="false">
            <classfileset dir="${dest.dir}" includes="*.class" />
            <classpath>
                <pathelement path="${dest.dir}" />
            </classpath>
            <xmlfileset dir="${basedir}" includes="testng.xml" />
        </testng>
    </target>
</project>

本文转自 知止内明 51CTO博客,原文链接:http://blog.51cto.com/357712148/1891279,如需转载请自行联系原作者
你可能感兴趣的文章
056-创建任意用户组并在任意用户组内创建用户
查看>>
Lock和synchronized比较详解
查看>>
Yii2 Queue队列启动
查看>>
用Python画ROC曲线
查看>>
使用Spring Boot构建独立的OAuth服务器(一)
查看>>
LMAP架构介绍与安装MySQL
查看>>
队列(queue)
查看>>
企业级 SpringCloud 教程 (五)路由网关(zuul)
查看>>
【极简版】SpringBoot+SpringData JPA 管理系统
查看>>
使用docker镜像玩转steam挂卡
查看>>
激发个人潜能凝聚团队力量——九八七酒业户外拓展活动圆满成功
查看>>
修改root密码方式及克隆虚拟机
查看>>
hadoop技术入门学习之发行版选择
查看>>
thinkphp简介
查看>>
nodejs RSA 与 jsencrypt实现前端加密后端解密功能
查看>>
学习笔记sql server数据库批量查询和删除内容执行语句
查看>>
SpringBoot同时集成Guava和Redis作为缓存
查看>>
(二)Java B2B2C o2o多用户商城 springcloud架构-服务消费者(rest+ribbon)
查看>>
微服务的断路器实现图解Golang通用版
查看>>
3. window 上安装redis(单机版) 及客户端
查看>>