WEB开发网
开发学院软件开发Java Java应用程序工程模板 阅读

Java应用程序工程模板

 2010-01-22 00:00:00 来源:WEB开发网   
核心提示: 二、log4j.propertieslog4j.rootLogger=INFO,CONSOLE,LOGFILE##CONSOLElog4j.appender.CONSOLE=org.apache.log4j.ConsoleAppenderlog4j.appender.Threshold=INFO

二、log4j.properties

log4j.rootLogger=INFO,CONSOLE,LOGFILE
## CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.Threshold=INFO
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss } - %-5p %c        %x - %m%n
## logfile
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.File=testapp.log
log4j.appender.LOGFILE.MaxFileSize=10MB
log4j.appender.LOGFILE.MaxBackupIndex=10
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss } -    %-p %c     %x - %m%n

三、build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="testapp" basedir="." default="compile">
        <property environment="env"/>
        <property name="build.dir" value="./testapp"/>
        <property name="classes.dir" value="${build.dir}/bin"/>
        <property name="dist.dir" value="./testapp"/>
        <path id="classpath">
                <fileset dir="./lib">
                        <include name="*.jar"/>
                </fileset>
        </path>
        <target name="compile" depends="clean">
                <mkdir dir="${build.dir}"/>
                <mkdir dir="${classes.dir}"/>
                <mkdir dir="${build.dir}/lib"/>
                <copy toDir="${classes.dir}" failonerror="false">
                        <fileset dir="./src">
                                <include name="**/*.*"/>
                                <exclude name="**/*.java"/>
                                <exclude name="**/*.log"/>
                                <exclude name="**/*.iws"/>
                                <exclude name="**/*.ipr"/>
                                <exclude name="**/*.iml"/>
                        </fileset>
                </copy>
                <copy toDir="${build.dir}/lib" failonerror="false">
                        <fileset dir="./lib">
                        </fileset>
                </copy>
                <javac debug="on"
                             fork="true"
                             encoding="GBK"
                             destdir="${classes.dir}"
                             srcdir="./src"
                             extdirs="**/test/**"
                             classpathref="classpath">
                </javac>
        </target>
        <target name="jar" depends="compile">
                <mkdir dir="${dist.dir}"/>
                <copy toDir="${dist.dir}" failonerror="false">
                        <fileset dir="./src">
                                <include name="*.xml"/>
                                <include name="*.properties"/>
                                <include name="*.sh"/>
                        </fileset>
                </copy>
                <jar destfile="${dist.dir}/testapp.jar">
                        <fileset excludes="**/Test*.class,**/*.xml,**/*.properties,**/*.log,**/*.sh" dir="${classes.dir}"/>
                </jar>
        </target>
        <target name="clean">
                <delete dir="${build.dir}"/>
                <delete dir="${dist.dir}"/>
                <delete dir="${build.dir}/lib"/>
        </target>
        <target name="all" depends="clean,compile,jar"/>
</project>

本文出自 “熔 岩” 博客,转载请与作者联系!

文章来源:http://lavasoft.blog.51cto.com/62575/263548

本文示例源代码或素材下载

上一页  1 2 

Tags:Java 应用程序 工程

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接