当前位置: 代码迷 >> Web前端 >> ant webproject.
  详细解决方案

ant webproject.

热度:353   发布时间:2012-12-19 14:13:14.0
ant webproject....
<?xml version="1.0"  encoding="UTF-8"?>
<project name="TestWeblogic103" default="war" basedir=".">
<property name="src.dir" value="src"></property>
<property name="build.dir" value="build"></property>
<property name="webapp.dir" value="WebRoot"></property>
<property name="war.dir" value="src"></property>

<path id="classpath">
<fileset file="${webapp.dir}/WEB-INF/lib/*.jar"></fileset>
<pathelement path="${build.dir}/classes"/>
</path>

<target name="clean"> 
        <delete dir="${build.dir}" /> 
</target> 

<target name="compile" depends="clean"> 
        <mkdir dir="${build.dir}/classes" /> 
        <javac srcdir="${src.dir}" destdir="${build.dir}/classes" includeAntRuntime="true"> 
            <compilerarg line="-encoding UTF-8" /> 
            <classpath refid="classpath" /> 
        </javac> 

  <fileset dir="${src.dir}"> 
     <include name="**/*.xml" /> 
     <include name="**/*.properties" />     
  </fileset>      
</target> 

<target name="war" depends="compile"> 
        <war destfile="${build.dir}/${ant.project.name}.war" webxml="${webapp.dir}/WEB-INF/web.xml"> 
           <fileset dir="${webapp.dir}"> 
              <!--  
                <include name="**/*.jsp" /> 
                <include name="**/*.html" /> 
                <include name="**/*.xml" /> 
               --> 
            </fileset> 
            <lib dir="${webapp.dir}/WEB-INF/lib" /> 
            <classes dir="${build.dir}/classes" /> 
       </war> 
    </target>

</project>




给applet 签个名吧。。
以下代码摘自网上,,谢谢了
<target name="Generate_key"  description="生成数字证书" >
  <echo message="生成数字证书...." />
  <genkey alias="swan" storepass="${storepass}" keypass="${keypass}" validity="${validity}" keystore="${keystore.file}">
   <dname>
    <param name="CN" value="${dname.CN}" />
    <param name="OU" value="${dname.OU}" />
    <param name="O" value="${dname.O}" />
    <param name="C" value="${dname.C}" />
    <param name="L" value="${dname.L}" />
    <param name="ST" value="${dname.ST}" />
   </dname>
  </genkey>
  <echo message="证书生成成功." />
</target>

3.对Jar文件进行数字签名

<target name="jarsigner" depends="Generate_key" description="进行数字签名">

  <echo message="====================================" />
  <echo message="进行数字签名..." />
  <signjar jar="${jar.name}" alias="${alias}" storepass="${storepass}" keystore="${keystore.file}" />
  <echo message="签名成功." />
  <echo message="====================================" />
</target>