码迷,mamicode.com
首页 > 编程语言 > 详细

build.xml实例:清目录、编译java、编译scala、打包

时间:2018-04-20 11:47:06      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:prope   comm   bug   lib   property   cdir   src   tor   deb   

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

<project basedir="src" default="jar">

<property name="web.dir" value="bing"/>
<property name="src.dir" value="${basedir}/main/scala"/>
<property name="srcjava.dir" value="${basedir}/main/java"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="build.dir" value="${web.dir}/classes"/>
<property name="temp.dir" value="${web.dir}/temp"/>

<path id="build.classpath">
<pathelement location="${build.dir}" />
<pathelement location="${basedir}/lib/hbase-client-1.0.0-cdh5.5.1.jar" />
<pathelement location="${basedir}/lib/hbase-common-1.0.0-cdh5.5.1.jar" />
<pathelement location="${basedir}/lib/hbase-server-1.0.0-cdh5.5.1.jar" />
<pathelement location="${basedir}/lib/kafka-clients-0.8.2.1.jar" />
<pathelement location="${basedir}/lib/spark-streaming_2.10-1.5.0-cdh5.5.1.jar" />
<pathelement location="${basedir}/lib/spark-streaming-kafka_2.10-1.5.0.jar" />
<fileset dir="${basedir}/lib/repository">
<include name="**/*.jar"/>
</fileset>
</path>

<target name="scala.tasks">
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${basedir}/lib/scala-compiler.jar" />
<pathelement location="${basedir}/lib/scala-library-2.10.4.jar" />
<pathelement location="${basedir}/lib/scala-reflect.jar" />
</classpath>
</taskdef>
</target>
<target name="clean">
<delete dir="${web.dir}"> </delete>
<delete dir="${build.dir}"> </delete>
</target>

<target name="compile" depends="clean,scala.tasks">
<mkdir dir="${build.dir}" />
<javac destdir="${build.dir}" source="1.7" target="1.7" debug="true"
encoding="utf-8" deprecation="false" optimize="false" failonerror="true">
<src path="${srcjava.dir}" />
<classpath refid="build.classpath"/>
</javac>
<scalac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath" scalacdebugging="true">
<include name="**/*.scala" />
</scalac>
</target>

<target name="build" depends="compile" >
<jar jarfile="${web.dir}/scala.jar" basedir="${build.dir}">
</jar>
</target>
<target name="unziplib" depends="build">
<mkdir dir="${temp.dir}" />
<unjar dest="${temp.dir}">
<fileset dir="${basedir}/lib" includes="**/*.jar" />
</unjar>
<copy todir="${build.dir}">
<fileset dir="${temp.dir}">
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</fileset>
</copy>
</target>
<target name="jar" depends="unziplib">
<jar jarfile="${web.dir}/final.jar" basedir="${build.dir}" >
</jar>

</target>

</project>

build.xml实例:清目录、编译java、编译scala、打包

标签:prope   comm   bug   lib   property   cdir   src   tor   deb   

原文地址:https://www.cnblogs.com/junlinqunxia/p/8889243.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!