首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Ant实战篇 (2)

2012-07-29 
Ant实战篇 (二)???? ?property filebuild.properties/?? ???? javac destdir${classes}?? ?????

Ant实战篇 (二)

?

?
?? ?<property file="build.properties"/>

?? ???? <javac destdir="${classes}">
?? ???????? <src path="${src}"/>
?? ???? </javac>
?? ?</target>
?? ?
?? ?<target name="jar" depends="build">
?? ???? <jar destfile="${jar}/age.jar">
?? ???????? <fileset dir="${classes}"/>
???????? <manifest>
????????? <attribute name="Built-By" value="${author.name}"/>
?????? <attribute name="Main-Class" value="MyVirtualAge"/>
???????? </manifest>
?? ???? </jar>
?? ?</target>
?? ?
?? ?<target name="run" depends="jar">
?? ???? <java classname="MyVirtualAge"?
???????? fork="true"
???????? failonerror="true">
???????? <arg value="-jar"/>?
???????? <classpath>
????????? <pathelement location="${jar}/age.jar"/>
???????? </classpath>
??????? </java>
?? ?</target>
?? ?
?? ?<target name="runjar" depends="jar">
?? ???? <java jar="${jar}/age.jar"?
???????? fork="true"
???????? failonerror="true">
???????? <arg value="-jar"/>?
???????? <classpath>
????????? <pathelement location="${jar}/age.jar"/>
???????? </classpath>
??????? </java>
?? ?</target>

?
?? ?<property file="build.properties"/>
?? ?
?? ?<path id="bea.class.path">
??????? <fileset dir="${weblogic.lib}">
??????????? <include name="weblogic.jar"/>
??????? </fileset>
??? </path>

?? ???? <javac srcdir="${src}" destdir="${classes}" includes="*.java">
?? ???????? <classpath refid="bea.class.path"/>
?? ???? </javac>
?? ?</target>
?? ?
?? ?<target name="jar" depends="build">
?? ???? <jar destfile="${jar}/${ejb.name}.jar">
?? ???????? <fileset dir="${classes}"/>
?? ???????? <manifest>
????????? <attribute name="Built-By" value="${author.name}"/>
?????? <attribute name="Main-Class" value="Client"/>
???????? </manifest>
?? ???? </jar>
?? ?</target>
?? ?
?? ?<target name="deploy" depends="jar">
?? ??<serverdeploy action="deploy" source="${jar}/${ejb.name}.jar">
???????? <weblogic application="${ejb.name}"
????????? server="t3://127.0.0.1:7001"
????????? classpath="${weblogic.lib}/weblogic.jar"
????????? username="${username}"?
????????? password="${user.password}" ?
????????? component="${ejb.name}:myserver"?????
???? ???? debug="true"/>
??????? </serverdeploy>
?? ?</target>?
?? ?
?? ?<target name="redeploy" depends="jar">
?? ??<serverdeploy action="update" source="${jar}/${ejb.name}.jar">
???????? <weblogic application="${ejb.name}"
????????? server="t3://127.0.0.1:7001"
????????? classpath="${weblogic.lib}/weblogic.jar"
????????? username="${username}"?
????????? password="${user.password}" ?
????????? component="${ejb.name}:myserver"?????
???? ???? debug="true"/>
??????? </serverdeploy>
?? ?</target>?
?? ?
?? ?<target name="undeploy">
?? ??<serverdeploy action="undeploy">
???????? <weblogic application="${ejb.name}"
????????? server="t3://127.0.0.1:7001"
????????? classpath="${weblogic.lib}/weblogic.jar"
????????? username="${username}"?
????????? password="${user.password}"????
???? ???? debug="true"/>
??????? </serverdeploy>
?? ?</target>?
?? ?
?? ?<target name="delete">
?? ???? <serverdeploy action="delete">
???????? <weblogic application="${ejb.name}"
????????? server="t3://127.0.0.1:7001"
????????? classpath="${weblogic.lib}/weblogic.jar"
????????? username="${username}"
????????? password="${user.password}"/>
??????? </serverdeploy>
??? </target>
?? ?
?? ?<target name="run">
?? ???? <java classname="Client"?
???????? fork="true"
???????? failonerror="true">
???????? <classpath refid="bea.class.path"/>
???????? <classpath>?????????????
????????? <pathelement location="${weblogic.deploy.dir}/${ejb.name}/${ejb.name}.jar"/>
???????? </classpath>
??????? </java>
?? ?</target>

4> 启动Weblogic server,然后在age目录下首先运行ant deploy部署,然后运行ant run查看结果。

热点排行