我正在开发一个基本上是游戏引擎的项目,用于制作其他游戏。我在Netbeans工作。我的项目有两部分,引擎本身和正在运行的游戏核心。我想修改build.xml,以便在项目构建时,它需要一组包,并将它们编译成一个jar(游戏核心),其余的被编译成第二个jar,并放置第一个jar在第二个jar中的资产文件夹里面。这是可能的,还是我必须手动构建它?
尽管我进行了研究,但我目前对蚂蚁构建一无所知。
答案 0 :(得分:0)
我找到了一个使用此代码的解决方案。
<project name="WraithEngine2" basedir="." default="main">
<target name="clean">
<delete dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build"/>
<delete dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/dist"/>
</target>
<target name="jar">
<mkdir dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes1"/>
<mkdir dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes2"/>
<mkdir dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/dist"/>
<mkdir dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes1/Assets"/>
<mkdir dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes1/Native"/>
<javac srcdir="/home/thedudefromci/NetBeansProjects/WraithEngine2/src" destdir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes1">
<include name="build/**"/>
</javac>
<javac srcdir="/home/thedudefromci/NetBeansProjects/WraithEngine2/src" destdir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes2">
<include name="run/**"/>
</javac>
<copy todir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes1/Assets">
<fileset dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/src/Assets"/>
</copy>
<copy todir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes1/Native">
<fileset dir="/home/thedudefromci/NetBeansProjects/WraithEngine2/src/Native"/>
</copy>
<jar destfile="/home/thedudefromci/NetBeansProjects/WraithEngine2/dist/WraithGame.jar"
basedir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes2">
<manifest>
<attribute name="Main-Class" value="run.wraith.engine.WraithEngineGame"/>
</manifest>
</jar>
<copy file="/home/thedudefromci/NetBeansProjects/WraithEngine2/dist/WraithGame.jar" todir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes1/Native"/>
<jar destfile="/home/thedudefromci/NetBeansProjects/WraithEngine2/dist/WraithEngine.jar"
basedir="/home/thedudefromci/NetBeansProjects/WraithEngine2/build/classes1">
<manifest>
<attribute name="Main-Class" value="build.games.wraithaven.core.WraithEngine"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java jar="/home/thedudefromci/NetBeansProjects/WraithEngine2/dist/WraithEngine.jar" fork="true"/>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>