从一个实例浅谈J2ME Polish的build功能(二、环境的搭建)

    上一篇文章,我们大致讲了polish的一个基本应用,但我们手头上有同一个游戏不同版本的代码的时候,我们就开始利用polish进行整合,那么在利用polish之前,我们必须把环境搭配好,接下来简单的谈谈polish环境的搭建。
     1、eclipse me+jdk+wtk这是开发环境,一般移动百宝箱需要我们用wtk1.0.4,而一般我们开发可以用更高的版本wtk2.2.
     2、ant工具(ant是一个基于JAVA的自动化脚本引擎,脚本格式为XML。除了做JAVA编译相关任务外,ANT还可以通过插件实现很多应用的调用。)
     3、polish安装文件
     4、build.xml文件
     对于第一条,我想这样的文章已经很多了,我就不说了。关于ant工具,大家可以去下ant的免安装包,解压缩路径假如是E:/ant/,那么把E:/ant/bin;添加到系统环境变量中的path中就可以了。这个时候你打开cmd,敲入ant后如果提示:
Warning:   JAVA_HOME environment variable is not set.
  If build fails because sun.* classes could not be found
  you will need to set the JAVA_HOME environment variable
  to the installation directory of java.

  Buildfile: build.xml does not exist!
  Build failed
则说明安装成功,警告没有可供解析的build.xml文件,这个工具到底用来干嘛的,等我们最后分析完build.xml的时候,大家就知道了。
    polish的下载安装也很简单,大家可以搜索一下,安装就可以了,笔者的安装路径是E:/JAVA/J2ME-Polish。
    接下来就是定制自己的build.xml了。笔记给出一个简单例子,并简单给出解释,希望对大家有所帮助:
 <project   
    name="KalaPolish" ------------------------------------------>你的项目名称
    default="j2mepolish">
    <property file="${user.name}.properties" />   
    <property name="polish.home" location="E:/JAVA/J2ME-Polish" /> --------------------------->你的polish安装路径
    <property name="wtk.home" location="E:/JAVA/WTK22" /> --------------------------->你的wtk安装路径
    <property file="${polish.home}/global.properties" />
   
<!-- Definition of the J2ME Polish task:-->
    <taskdef name="j2mepolish"
        classname="de.enough.polish.ant.PolishTask"
        classpath="${polish.home}/import/enough-j2mepolish-build.jar:${polish.home}/import/jdom.jar:${polish.home}/import/proguard.jar:${polish.home}/yguard-lib.jar:${wtk.home}/wtklib/kenv.zip"/>

       
   
<!-- build targets, each target can be called via "ant [name]",
     e.g. "ant clean", "ant test j2mepolish" or just "ant" for calling the default-target -->
   
    <target name="setdeploy"
        description="Call this target first to set the OTA download-URL, e.g. ant setdeploy j2mepolish"
        >
        <property name="deploy-url" value="http://www.company.com/download/" />
    </target>
   
    <target name="enableDebug"
        description="Call this target first to skip the obfuscation step, call the emulator and start the debugger, e.g. ant enableDebug j2mepolish"
        >
        <property name="debug" value="true" />
    </target>
   
       
<target name="test"
        description="Call this
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值