Ant编译时遇到的问题记录

发表于:2014-7-07 11:16

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:娇娇家的美衣阁    来源:51Testing软件测试网采编

  1. 需要使用svnant,从SVN中获取源码
  需要使用的扩展包:svnant-1.3.1.zip里所有的jar
  下载地址:http://subclipse.tigris.org/files/documents/906/49042/svnant-1.3.1.zip
  build.xml中的写法
<!--定义SVN地址-->
<property name="svnurl" value="http://xx/svn/projectName"/>
<!-- -->
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" />
<!--定义访问SVN的账号和密码-->
<svnSetting id="svn.setting" svnkit="true" username="username" password="password"  javahl="false" />
<!--检出代码到${project.dir}变量定义的目录下-->
<target name="export">
<delete dir="${project.dir}" />
<mkdir dir="${project.dir}" />
<svn refid="svn.setting">
<export srcUrl="${svnurl}" destPath="${project.dir}" force="true"/>
</svn>
</target>
  2.foreach循环需要使用ant-contrib-1.0b3.jar
  下载地址请百度
  build.xml中的写法
  <target name="loop" >
  <foreach list="src" target="all" param="src_loop" delimiter=","></foreach>
  </target>
  3. yguard代码混淆
  具体介绍参见:http://blog.csdn.net/vrix/article/details/7604636
  官网下载地址:http://www.yworks.com/en/downloads.html
  build.xml中的写法
<taskdef name="yguard" classname="com.yworks.yguard.YGuardTask"/>
<yguard>
<inoutpair in="${输入.jar}" out="${输出.jar}"/>
<shrink logfile="${build.dir}/shrink.xml">
<keep>
<class classes="friendly" methods="private" fields="friendly"/>
<field name="serialVersionUID"/>
</keep>
</shrink>
</yguard>
  4.执行脚本操作
  启动tomcat在build.xml中的写法
linux
<target name="start" >
<echo>start tomcat</echo>
<exec executable = "${tomcat.dir}/bin/startup.sh" />
</target>
windows
<target name="stop" >
<echo>stop tomcat</echo>
<exec executable="cmd" dir="${tomcat.dir}/bin" failonerror="false"  append="true">
<env key="CATALINA_HOME" path="${tomcat.dir}"/>
<arg value="/c startup.bat" />
</exec>
</target>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号