普通java工程打包脚本

  1. build.xml

 

<project basedir="." default="jar" name="core">

 

<target name="init">

 

<!--     property settings    -->

 

<property file="build.properties" />

 

 

 

<echo message="----------- ${Name} ${version} [${year}] ------------" />

 

 

 

<property name="debug" value="off" />

<property name="optimize" value="on" />

<property name="deprecation" value="on" />

 

 

 

<!--<property name="mycedatasycn.location" value="D:/project/myce/mycedatasycn" />-->

 

 

<!-- java源文件路径 -->

 

<property name="src.dir" value="${basedir}/src" />

 

 

 

<!--    jar包路径 -->

<property name="lib.dir" value="${basedir}/lib" />

 

 

 

 

 

 

<!--    准备源文件路径 -->

<property name="build.src" value="${basedir}/build/classes" />

 

 

 

<!--    编译源文件路径 -->

<property name="build.dest" value="${basedir}/build/bin" />

 

 

 

<!--    准备javadoc文件路径 -->

<property name="build.javadocs" value="${basedir}/AntBuild/doc" />

 

 

 

<!--    打包jar文件路径 -->

<property name="jar.dest" value="${basedir}/build/lib" />

<path id="classpath">

<fileset dir="${lib.dir}">

<include name="**/*.jar" />

</fileset>

<!--<pathelement location="lib/"/>-->

</path>

 

<filter token="log" value="true" />

<filter token="verbose" value="true" />

</target>

 

 

 

<!-- =================================================================== -->

<!-- Help on usage -->

<!-- =================================================================== -->

<target name="usage" depends="init">

<echo message="${Name} Build file" />

<echo message="-------------------------------------------------------------" />

<echo message="" />

<echo message=" available targets are:" />

<echo message="" />

<echo message=" jar --> generates the ${name}.jar file" />

<echo message=" build --> compiles the source code" />

<echo message=" javadoc --> generates the API documentation" />

<echo message=" clean --> cleans up the directory" />

<echo message="" />

<echo message=" Please rename build.properties.default to build.properties" />

<echo message=" and edit build.properties to specify JSDK 2.3 classpath." />

<echo message="" />

<echo message=" See the comments inside the build.xml file for more details." />

<echo message="-------------------------------------------------------------" />

<echo message="" />

<echo message="" />

</target>

 

 

 

<!-- =================================================================== -->

<!-- 准备源文件-->

<!-- =================================================================== -->

<target name="prepare-src" depends="init">

<!-- create directories -->

<mkdir dir="${basedir}/build" />

<mkdir dir="${build.src}" />

<mkdir dir="${build.dest}" />

<mkdir dir="${jar.dest}" />

 

<!-- copy src files -->

<copy todir="${build.src}">

<fileset dir="${src.dir}/main/java" />

<fileset dir="${src.dir}/main/resources" />

</copy>

</target>

 

 

 

<!-- =================================================================== -->

<!-- 编译源文件-->

<!-- =================================================================== -->

<target name="build" depends="clean,prepare-src">

<javac srcdir="${build.src}" destdir="${build.dest}" debug="${debug}" optimize="${optimize}">

<classpath refid="classpath" />

<compilerarg line="-encoding UTF-8 " />

</javac>

<copy todir="${build.dest}">

<fileset dir="${build.src}">

<include name="**/*.xml" />

<include name="**/*.properties" />

</fileset>

</copy>

</target>

 

<target name="jar" depends="build">

<jar destfile="${jar.dest}/${product.name}-${product.version}.jar" basedir="${build.dest}">

</jar>

</target>

<!-- =================================================================== -->

<!-- 产生javadoc api 文档-->

<!-- =================================================================== -->

<target name="javadoc" depends="build">

<mkdir dir="${build.javadocs}" />

<javadoc packagenames="${packages}" sourcepath="${build.src}" destdir="${build.javadocs}" author="true" version="true" use="true" splitindex="true" windowtitle="${Name} API" doctitle="${Name}">

<classpath refid="classpath" />

</javadoc>

</target>

<!-- =================================================================== -->

<!-- 清除临时文件-->

<!-- =================================================================== -->

<target name="clean" depends="init">

<delete dir="${basedir}/build" />

</target>

 

 

</project>

 

  1. build.properties

 

#工程前缀

project.perfix=empi

#工程名称

product.name=core

#工程版本号

product.version=1.0

#编译作者

user.name=

#公司名称

company.name=supcon

#以下变量暂未用,以后扩展

 

thirdParty.include.jar=*.jar

thirdParty.exclude.jar=

 

 

internal.include.jar=*.jar

internal.exclude.jar=

 

 

 

package generconfig; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.config.Configuration; import org.mybatis.generator.config.xml.ConfigurationParser; import org.mybatis.generator.exception.InvalidConfigurationException; import org.mybatis.generator.exception.XMLParserException; import org.mybatis.generator.internal.DefaultShellCallback; import org.springframework.context.support.GenericXmlApplicationContext; import com.pactera.service.schedule.ThreadReadPath; import com.pactera.util.CommTool; /*打包用File->Export->runnable JAR File Export Launch选择对应的类 Export destination 选择地址 Library handling:Copy required */ public class SMSThreadSender { public static void main(String[] args) { if(args.length==0) { System.out.println("短信服务开启,开始加载Spring配置。"); GenericXmlApplicationContext context = new GenericXmlApplicationContext(); context.setValidating(false); context.load("classpath:sysconfig/applicationContext.xml"); context.refresh(); System.out.println("开整·~~~~"); CommTool.smsthreadisruning=true; ThreadReadPath thread = new ThreadReadPath(); thread.smsname="sms"+CommTool.threadid; Thread t1 = new Thread(thread); t1.setName("sms"); t1.start(); System.out.println("已经启动"); } if(args.length==1) { String pfile=args[0]; System.out.println("短信服务开启,开始加载Spring配置。"+pfile); GenericXmlApplicationContext context = new GenericXmlApplicationContext(); context.setValidating(false); context.load(pfile); // context.load("classpath:sysconfig/applicationContext.xml"); context.refresh(); CommTool.smsth
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值