|
步骤:1.先下载ant。可以到 ant官网 http://ant.apache.org/ 进行下载。 到官网后,先点击Binary Distributions。 换页后,把画面拉下来一点 下载.....1.8.4-bin.zip(前面档名省略)。下载好后请先解压缩,放到合适的位置(建议在C槽下建立一个javalib资料夹,裡面可放入这些常用的jar包)。接下来是进行ant的环境配置,配置好后可以在CMD中输入 ant -version查询版本,能够查询到就表示安装成功。 2.在代码资料夹中新建一个build.xml,摆放位置参考下图(参考红色框框,摆放build.xml) build.xml的内容可以参考官方wiki,网址http://mcp.ocean-labs.de/index.php/Ant_Builds_with_MCP。 <?xml version="1.0" encoding="UTF-8" ?> <project name="Sample" basedir="." default="all"> <!-- Your name here --> <property name="author" value="C. Reeper" /> <!-- Your release version here --> <property name="version" value="1.0.0" /> <!-- Choose ".zip" or ".jar" as the dist file extension --> <property name="filetype" value="zip" /> <!-- Update if mcp directory isn't in same location as this file --> <property name="mcp.dir" location="./mcp" /> <!-- Update if dist directory isn't in same location as this file --> <property name="dist.dir" location="./dist" /> <!-- Update only if build directory isn't in same location as this file --> <property name="build.dir" location="./build" /> <!-- Update to point to your Python executable. Example: /usr/bin/python --> <!-- The following location is for Windows: --> <property name="python" location="${mcp.dir}/runtime/bin/python/python_mcp.exe" /> <target name="init" description="Initialize build environment"> <echo message="Cleaning old build and dist, MCP reobf directories" /> <delete dir="${build.dir}" /> <delete dir="${dist.dir}" /> <delete dir="${mcp.dir}/reobf" /> <echo message="Creating build and dist dirs" /> <mkdir dir="${build.dir}" /> <mkdir dir="${dist.dir}" /> </target> <target name="recompile" description="MCP recompile" > <exec executable="${python}" dir="${mcp.dir}"> <arg value="runtime/recompile.py"/> <arg value="%*"/> </exec> </target> <target name="reobfuscate" description="MCP reobfuscate"> <exec executable="${python}" dir="${mcp.dir}"> <arg value="runtime/reobfuscate.py"/> <arg value="%*"/> </exec> </target> <target name="stage" description="Stage resources into build directory"> <copy todir="${build.dir}"> <fileset dir="${mcp.dir}/reobf/minecraft" excludes=".svn/**, *.txt" /> </copy> <!-- Copy other stuff specific to your project --> </target> <target name="all" description="Perform all tasks for a build" depends="init, recompile, reobfuscate, stage, jarzip"> <echo message="MCP Ant Build Completed!" /> </target> <target name="jarzip" description="Jar (or zip) the project's dist output"> <mkdir dir="${dist.dir}" /> <jar destfile="${dist.dir}/${ant.project.name}${version}.${filetype}" duplicate="preserve" index="true" manifestencoding="UTF-8"> <manifest> <attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)"/> <attribute name="Implementation-Vendor" value="${author}"/> <attribute name="Implementation-Title" value="${ant.project.name}"/> <attribute name="Implementation-Version" value="${version}"/> </manifest> <fileset dir="${build.dir}" /> </jar> </target> </project> 记得修改几个地方, <property name="author" value="C. Reeper" /> 作者,自己的作品当然输入自己的名字 <property name="version" value="1.0.0" /> 版号 <property name="filetype" value="zip" /> 产出是zip或jar <property name="mcp.dir" location="./mcp" /> 主要目录,各位如果从上面看下来,那这地方我的就应该修改成mcp62 都弄好后!!! 把build.xml档案拖拉到你的项目内,会弹出视窗 ,选择Link to files就好啦!! 都完成拉,就剩下执行,大功告成!!产出的档案会在dist里面。 |
提升卡
观察者