build.xml实例:清目录编译java编译scala打包
Posted 君临裙下
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了build.xml实例:清目录编译java编译scala打包相关的知识,希望对你有一定的参考价值。
<?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打包的主要内容,如果未能解决你的问题,请参考以下文章