中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Ant自動化構建項目

發布時間:2020-06-27 17:16:15 來源:網絡 閱讀:289 作者:jethai 欄目:開發技術

1 普通java項目



<?xml version="1.0" encoding="UTF-8"?>
<project default="ftp">
    <property name="src.dir" location="src"></property>
    <property name="test.src.dir" location="test"></property>
    <property name="lib.dir" location="lib"></property>
    <property file="build.properties"></property>
    
    <property name="build.dir" location="build"></property>
    <property name="build.classes" location="${build.dir}/classes"></property>
    <property name="build.test.dir" location="${build.dir}/test"></property>
    <property name="build.test.classes" location="${build.test.dir}/classes"></property>
    <property name="build.test.report" location="${build.test.dir}/report"></property>
    <property name="build.jar.dir" location="${build.dir}/dist"></property>
    <property name="build.zip.dir" location="${build.dir}/zip"></property>
    <property name="build.doc.dir" location="${build.dir}/doc"></property>
    <property name="build.src" location="${build.dir}/src"></property>
    <property name="metadata.dir" location="metadata"/>
    
    <path id="compile-classpath">
        <fileset dir="${lib.dir}" includes="*.jar"></fileset>
    </path>
    
    <path id="compile-test-classpath">
        <path refid="compile-classpath"></path>
        <pathelement location="${build.classes}"/>
    </path>
    
    <path id="run-test-classpath">
        <path refid="compile-test-classpath"/>
        <pathelement location="${build.test.classes}"/>
    </path>
    
    <target name="clean">
        <delete dir="${build.dir}"/>
    </target>
    
    <target name="init" depends="clean,metadata">
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.classes}"/>
        <mkdir dir="${build.test.dir}"/>
        <mkdir dir="${build.test.classes}"/>
        <mkdir dir="${build.test.report}"/>
        <mkdir dir="${build.jar.dir}"/>
        <mkdir dir="${build.zip.dir}"/>
        <mkdir dir="${build.doc.dir}"/>
        <mkdir dir="${build.src}"/>
        <mkdir dir="${metadata.dir}"/>
    </target>
    
    <target name="compile" depends="init">
        <javac destdir="${build.classes}" srcdir="${src.dir}" 
            classpathref="compile-classpath" 
               includeantruntime="true" failonerror="true"></javac>
        <copy todir="${build.classes}">
            <fileset dir="${src.dir}" includes="**/*.*" excludes="**/*.java"></fileset>
        </copy>
    </target>
    
    <target name="compile-test" depends="compile">
        <javac destdir="${build.test.classes}" srcdir="${test.src.dir}"
               includeantruntime="true" failonerror="true" 
               classpathref="compile-test-classpath"></javac>
    </target>
    
    <target name="run-test" depends="compile-test">
        <junit fork="true" haltonfailure="false" failureproperty="junit.fail">
            <classpath refid="run-test-classpath"></classpath>
            <formatter type="brief" usefile="false"/>
            <formatter type="xml"/>
            <batchtest todir="${build.test.report}">
                <fileset dir="${build.test.classes}" includes="${run.test.class}"></fileset>
            </batchtest>
        </junit>
        <junitreport todir="${build.test.report}">
            <fileset dir="${build.test.report}" includes="TEST-*.xml"></fileset>
            <report format="frames" todir="${build.test.report}/html"/>
        </junitreport>
        <fail if="${junit.fail}" message="單元測試失敗,具體情況請查詢${build.test.report}"/>
    </target>
    
    <target name="doc" depends="run-test">
        <javadoc sourcepath="${src.dir}" use="true" packagenames="cn.*" 
               charset="UTF-8" encoding="UTF-8" docencoding="UTF-8"
               destdir="${build.doc.dir}">
            <classpath refid="compile-classpath"></classpath>
        </javadoc>
    </target>
    
    <target name="jar" depends="doc">
        <tstamp>
            <format property="now" pattern="yyyy=MM-dd HH:mm:ss"/>
        </tstamp>
        <jar destfile="${build.jar.dir}/${project.jar.name}" 
                basedir="${build.classes}" duplicate="preserve">
            <manifest>
                <attribute name="Build-By" value="${user.name}"/>
                <attribute name="Build-time" value="${now}"/>
            </manifest>
        </jar>        
    </target>
    
    <target name="copy-src" depends="jar">
        <copy todir="${build.src}">
            <fileset dir="${src.dir}" includes="**/*.*"></fileset>
        </copy>
    </target>
    
    
    <target name="metadata">
        <mkdir dir="${metadata.dir}"/>
        <buildnumber/>
        <propertyfile file="${metadata.dir}/build.propterties">
            <entry key="Build-time" type="date" value="now" pattern="yyyy-MM-dd HH:mm:ss"/>
            <entry key="build-number" type="int" value="${build.number}"/>
        </propertyfile>
    </target>
    
    <target name="zip" depends="copy-src">
        <zip destfile="${build.zip.dir}/${project.zip.name}" duplicate="preserve">
            <zipfileset file="${build.jar.dir}/${project.jar.name}" prefix="${project.prefix}"/>
            <zipfileset dir="${build.src}" includes="**/*.*" prefix="${project.prefix}/src"></zipfileset>
            <zipfileset dir="${build.doc.dir}" includes="**/*.*" prefix="${project.prefix}/doc/api"></zipfileset>
            <zipfileset dir="${build.test.dir}" includes="**/*.*" 
                    excludes="report/*.*" prefix="${project.prefix}/test"></zipfileset>
            <zipfileset dir="." includes="build.xml,build.properties" prefix="${project.prefix}"></zipfileset>
        </zip>
    </target>
    
    <presetdef name="upload">
        <ftp userid="${ftp.username}" password="${ftp.password}" 
             server="${ftp.server}" remotedir="${ftp.dir}"></ftp>
    </presetdef>
    
    <target name="ftp" depends="zip">
        <upload action="mkdir"/>
        <upload action="put">
            <fileset dir="${build.zip.dir}" includes="${project.zip.name}"></fileset>
            </upload>
    </target>
    
</project>



build.properties

ftp.username = kh
ftp.password = 123
ftp.server = localhost
ftp.dir = user_manager
project.version = SNAPSHOT-0.1
project.prefix = usermanager-${project.version}
project.jar.name = ${project.prefix}.jar
project.zip.name = ${project.prefix}.zip
run.test.class = **/Test*.class


2 web項目

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <property name="src.dir" location="src"></property>
    <property name="build.dir" location="build"></property>
    <property name="build.classes" location="${build.dir}/classes"></property>
    <property name="build.war" location="${build.dir}/war"></property>
    
    <property name="web.name" value="hello"></property>
    <property name="web.root" value="WebContent"></property>
    <property name="web.WEB-INF" location="${web.root}/WEB-INF"></property>
    <property name="web.lib" location="${web.WEB-INF}/lib"></property>
    <property environment="env"></property>
    
    <path id="compile">
        <fileset dir="${web.lib}" includes="*.jar"></fileset>
        <fileset dir="${env.CATALINA_HOME}/lib" includes="*.jar"></fileset>
    </path>
    
    <target name="init">
        <delete dir="${build.dir}"></delete>
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.classes}"/>
        <mkdir dir="${build.war}"/>
    </target>
    
    <target name="compile" depends="init">
        <javac destdir="${build.classes}" srcdir="${src.dir}" classpathref="compile"></javac>
    </target>
    
    <target name="war" depends="compile">
        <war destfile="${build.war}/${web.name}.war">
            <fileset dir="${web.root}" includes="**/*.*"></fileset>
            <lib dir="${web.lib}"></lib>
            <webinf dir="${web.WEB-INF}"></webinf>
            <classes dir="${build.classes}"></classes>
        </war>
    </target>
    
    <presetdef name="sql-admin">
        <sql userid="root" password="123456" url="jdbc:mysql://localhost:3306/itat_msg?useUnicode=true&amp;characterEncoding=utf-8" driver="com.mysql.jdbc.Driver">
            <classpath refid="compile"></classpath>
        </sql>
    </presetdef>
    
    <target name="init-mysql">
        <sql-admin>
            <transaction>
                drop database ant_test;
                create database ant_test;
                GRANT ALL ON ant_test.* TO "ant_test"@"localhost" IDENTIFIED BY '123'
            </transaction>
        </sql-admin>
    </target>
    
    <target name="deploy" depends="war">
        <copy todir="${env.CATALINA_HOME}/webapps">
            <fileset dir="${build.war}" includes="${web.name}.war"></fileset>
        </copy>
    </target>
</project>


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

永登县| 东源县| 顺昌县| 澳门| 崇信县| 娄烦县| 茌平县| 蒙城县| 南昌县| 右玉县| 沧源| 班戈县| 广东省| 茌平县| 额尔古纳市| 天水市| 福泉市| 鲜城| 青岛市| 三亚市| 长宁区| 潢川县| 佛坪县| 周至县| 中方县| 桃江县| 庆元县| 泰来县| 科技| 双柏县| 崇信县| 甘德县| 兰州市| 百色市| 黄浦区| 浪卡子县| 马关县| 汤原县| 吴忠市| 镇平县| 兖州市|