zoukankan      html  css  js  c++  java
  • Ant 中 如何 echo 机器名?

    Ant 中 如何 echo 机器名?

    下面这个 build.xml 中。

    <?xml version="1.0" ?>

    <project name="BlackLineSelenium" default="junitReport" basedir=".">
        <property name="source.dir" value="src" />
        <property name="build.dir" value="build" />
        <property name="lib.dir" value="lib" />
        <property name="classes.dir" value="${build.dir}/classes" />
        <property name="report.dir" value="report"/>
        <property environment="env"/>
        <property name="env.HOSTNAME" value="${env.COMPUTERNAME}"/>
        <echo message="hostname = ${env.HOSTNAME}"/>
        <exec executable="hostname" outputproperty="computer.hostname"/>
        <!--<hostinfo prefix="eos" host="apache.org" ADDR4="140.211.11.130"/>-->


        <target name="clean">
            <delete dir="${classes.dir}" />
            <mkdir dir="${classes.dir}" />
            <delete dir="${report.dir}" />
            <mkdir dir="${report.dir}" />

            <echo> message="Base dir is: ${basedir}"</echo>
            <echo> message="source.dir is: ${source.dir}"</echo>
            <echo> message="build.dir is: ${build.dir}"</echo>
            <echo> message="lib.dir is: ${lib.dir}"</echo>
            <echo> message="classes.dir is: ${classes.dir}"</echo>
            <echo> message="report.dir is: ${report.dir}"</echo>
        </target>
        
        <target name="compile" depends="clean">
            <patternset id="lib.includes.compile">
                <include name="*.jar" />
            </patternset>
            <fileset dir="${lib.dir}" id="lib.compile">
                <patternset refid="lib.includes.compile" />
            </fileset>
            <pathconvert targetos="windows" property="libs.compile" refid="lib.compile" />
            <!-- compile -->
            <javac srcdir="${source.dir}" destdir="${classes.dir}" classpath="${libs.compile}" includes="**/*.java" debug="true" />
            <copy todir="${classes.dir}">
                <fileset dir="${source.dir}">
                    <include name="**/*.properties" />
                    <include name="**/*.xml" />
                </fileset>
            </copy>
        </target>

        <target name="junit" depends="compile">
            <junit printsummary="yes" fork="true" haltonfailure="false" failureproperty="tests.failed" showoutput="true">
                <classpath>
                    <pathelement path="${classes.dir}" />
                    <fileset dir="${lib.dir}">
                        <include name="*.jar" />
                    </fileset>
                </classpath>
                <formatter type="xml" />
                <batchtest todir="${report.dir}">
                    <fileset dir="${classes.dir}">
                        <include name="**/TestAll.class" />
                    </fileset>
                </batchtest>
            </junit>
        </target>
        
        <target name="executeRemote">
            <sshexec host="10.1.3.50"
                username="sshuser"
                password="qqqqq"
                trust="true"
                command="D:\bat.bat"/>
        </target>
        <target name="simpletask">
            <taskdef  name="simpletask" classname="com.xbosoft.blackline.AntSimpleTask" classpath="${build.dir}/classes"/>
            <simpletask/>
        </target>
        
        <target name="junitReport" depends="junit">
            <!--
            <junitreport todir="report">
                <fileset dir="report">
                    <include name="TEST-*.xml" />
                </fileset>
            -->    
                <!-- Allen added-->
            <!--
                <report styledir="reportstyle" format="frames" todir="report" />
                
            </junitreport>
            <fail if="tests.failed" />
            -->
        </target>

    </project>

    或者使用 <SSHEXEC> 执行一个外部命令

        <target name="executeRemote">
            <sshexec host="10.1.3.50"
                username="sshuser"
                password="qqqqq"
                trust="true"
                command="hostname"/>
        </target>

  • 相关阅读:
    网络测量中基于Sketch方法的简单介绍
    Reading SBAR SDN flow-Based monitoring and Application Recognition
    Reading Meticulous Measurement of Control Packets in SDN
    Reading SketchVisor Robust Network Measurement for Sofeware Packet Processing
    ovs加dpdk在日志中查看更多运行细节的方法
    后缀数组
    (转载)LCA问题的Tarjan算法
    Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A. Checking the Calendar(水题)
    Vijos 1816统计数字(计数排序)
    卡特兰数
  • 原文地址:https://www.cnblogs.com/backpacker/p/2812377.html
Copyright © 2011-2022 走看看