建立Robocode开发向导
作者:coolflyr_reg 日期:2007-11-24 19:15:33
Content
Introduction
This page is meant for developers who want to compile and build Robocode. If you just want to browse the sources, you can do it from
here
.
All sources are available from the Robocode CVS Repository on
SourceForge
, and
here
you can read of how to access the CVS for Robocode.
Basically, you can just download the CVS modules for Robocode, and then run the Ant build script provided for each CVS module, or use your favourite IDE for compiling and building Robocode. However, this guide will describe how to set everything up based on the
Eclipse SDK
. The Eclipse SDK is a very popular IDE, which is free of charge, and which contains all necessary tools in order to access the CVS, run the Ant build scripts etc. So if you use Eclipse you don't have to worry too much of how to setup the IDE for building Robocode. If you should rather like to use another IDE, then you'll have to figure out by yourself of how to do it based on the information provided in this guide. If you figure it out, then you could send the description to me, and I will include it in this guide.
Software requirements
Please notice
How to build Robocode in Eclipse step by step
The following steps assume that you have Java and Eclipse up and running, and describe how to create a workspace for Robocode, to extract the sources from the CVS, and how to build Robocode.
Running Robocode from Eclipse
The following assumes that all files have been downloaded and built in your Robocode workspace.
In order to run Robocode from eclipse, you must click on the green play-button from the toolbar in the top of the Eclipse IDE. The first time you try to run Robocode, you must first click on the little arrow on the play-button and select Robocode.
About the Robocode CVS modules
About the build
All output files of Robocode are created in the
folder.
The
script contains various targets for building various parts for the Robocode distribution file. The default target is to build the Robocode setup file necessary for installing Robocode. The Robocode setup file contains all necessary files for installing and running Robocode including files from the
module. The
is also responsible of building the Javadoc files of Robocode. So if the Robocode API is changed, the Javadoc is automatically built and put in the distribution/setup file.
- Introduction
- Software requirements
- How to build Robocode in Eclipse step by step
- Running Robocode from Eclipse
- About the Robocode CVS modules
- About the build
Introduction
This page is meant for developers who want to compile and build Robocode. If you just want to browse the sources, you can do it from
here
.
All sources are available from the Robocode CVS Repository on
SourceForge
, and
here
you can read of how to access the CVS for Robocode.
Basically, you can just download the CVS modules for Robocode, and then run the Ant build script provided for each CVS module, or use your favourite IDE for compiling and building Robocode. However, this guide will describe how to set everything up based on the
Eclipse SDK
. The Eclipse SDK is a very popular IDE, which is free of charge, and which contains all necessary tools in order to access the CVS, run the Ant build scripts etc. So if you use Eclipse you don't have to worry too much of how to setup the IDE for building Robocode. If you should rather like to use another IDE, then you'll have to figure out by yourself of how to do it based on the information provided in this guide. If you figure it out, then you could send the description to me, and I will include it in this guide.
Software requirements
Please notice
- You must install the SDK version Eclipse and JDK version of Java, or else you will not be able to compile the Robocode sources! You also have to install the Java JDK before installing the Eclipse SDK.
- You must ensure that you have set up the environment variable named JAVA_HOME according to the installation notes for the Java Developer Kit (JDK), e.g. C:\jdk1.5.0_08 (on Windows). In addition, you must add JAVA_HOME/bin to your PATH environment variable, e.g. PATH=%PATH%;JAVA_HOME\bin under Windows, and $PATH=$PATH:$JAVA_HOME/bin under Linux and Mac. This must be done as Apatche Ant, which is used for building Robocode is depending on these environment variables, and will not be able to build Robocode without them.
How to build Robocode in Eclipse step by step
The following steps assume that you have Java and Eclipse up and running, and describe how to create a workspace for Robocode, to extract the sources from the CVS, and how to build Robocode.
- In Eclipse, select "Switch Workspace..." from the File menu. Type in a file path to a folder where you want the Robocode workspace to be located, where the name of the workspace could be something like "Robocode-workspace" or anything else you prefer. Eclipse will restart, and your Robocode workspace is ready.
- Now you need to add the Java SE 5.0 Runtime Environment (JRE), which is included in the Java SE JDK.
- Go to the Window menu and select "Preferences...".
- Locate the "Installed JREs" under the "Java" node in the left side of the Preferences window. You will have to click on the plus sign so the "Java" node unfolds in order to see the "Installed JREs".
- Check if the JRE for Java 5.0 is listed under "Installed JREs". If so, you don't need to add the JRE 5.0, as it is already added to Eclipse, and you can skip the following. If not, click on "Installed JREs" and press the "Add..." button on the right side of the window in order to add the JRE 5.0. A "Add JRE" window is opened where you:
- Click on the "Browse..." button and select the folder where you have installed the Java SE JDK 5.0.
- When this is done correctly, the list of "JRE System Libraries" is automatically filled out for you.
- Press "OK" to close the window.
- Click on the "Browse..." button and select the folder where you have installed the Java SE JDK 5.0.
- Press "OK" to close the Preferences windows.
- Go to the Window menu and select "Preferences...".
- In order to build Robocode, Ant (build tool) must point at the correct tools.jar in your JDK 5.0.
- In the Window menu, select the "Preferences...".
- Locate the "Runtime" under the "Ant" node in the left side of the Preferences window, and click on it.
- Expand the "Global Entries" by clicking on the plus sign.
- Check that Global Entries contains an entry which point to the ../lib/tools.jar file where your JDK 5.0 is installed. If no entry exists which point to the ../lib/tools.jar file in your JDK 5.0 you must add it by pressing the "Add External JARs..." button, and browse to and select the ../lib/tools.jar file from the folder where your JDK 5.0 is installed.
- Press "OK" to close the Preferences windows.
- In the Window menu, select the "Preferences...".
- Next the sources must be extracted from the Robocode CVS on source forge:
- In the File menu, hold the mouse over the first item, "New", and select the last item "Other...".
- A "New" window will open, where you must double-click on the "CVS" item and select "Projects from CVS".
- Press "Next".
- A new "Checkout from CVS" window will open where you make sure the "Create a new repository location" is selected, and press "Next".
- The content of the window will change, where you write:
- robocode.cvs.sourceforge.net into the text field for "Host".
- /cvsroot/robocode into the text field for "Repository path".
- anonymous in the text field for "User".
The "Connection type" must be "pserver" (is default), and "Use default port" must be selected.
- robocode.cvs.sourceforge.net into the text field for "Host".
- Press "Next".
- The content of the window will change, where you must select "Use an existing module..".
- Now you should be able to see a list of all available CVS modules in the Robocode CVS repository.
- Next, you must select these 4 modules and press "Next" afterwards (by holding the Ctrl on the keyboard down while clicking on each needed module):
- autoextract
- build
- robocode
- robocodeextract
The
1
CVSROOT
is used by the CVS only, so you don't need it. The
1
installapplet
is used for installing Robocode from a webpage on the Internet, so you don't need this either, but you are welcome to download it, if you want to inspect it.
- autoextract
- After having pressed "Next", a new window occurs ("Check Out As") where you make sure "Check out in the workspace as projects" is selected, and press "Finish".
- Now all 4 CVS modules are downloaded from the Robocode CVS repository into your Robocode workspace.
- Please notice, that Eclipse will automatically begin compiling/building files in the workspace while the sources are being downloaded from the Robocode CVS. However, you will not be able to run/launch Robocode yet.
- In the File menu, hold the mouse over the first item, "New", and select the last item "Other...".
- When all files have been downloaded from the CVS, and the building of the workspace has finished, you must first run the
1
build.xml
files in the
1
robocode
module/project. Right-click on the
1
robocode/build.xml
file and select the "1 Ant Build" under "Run As". This will compile all the sources of the Robocode game, and will also extract files from the
1
robocodeextract
into the
1
build
project for running Robocode. Notice, you don't have to run the
1
robocode/build.xml
every time you modify a source files and want to compile Robocode. This is done automatically by Eclipse for you.
Running Robocode from Eclipse
The following assumes that all files have been downloaded and built in your Robocode workspace.
In order to run Robocode from eclipse, you must click on the green play-button from the toolbar in the top of the Eclipse IDE. The first time you try to run Robocode, you must first click on the little arrow on the play-button and select Robocode.
About the Robocode CVS modules
- robocode, which contains:
- resources, the resources for the game, e.g. image and icon files.
- robocode, which is the Java package of Robocode containing all source files of the game.
- resources, the resources for the game, e.g. image and icon files.
- robocodeextract, which contains files beside the game itself like:
- The OS dependent stuff like icon files and batch files
- The sample robots
- The template files for creating a robot
- Template files for battles
- The Jikes compiler
- The license file
These files are necessary when building the installation/setup file for Robocode.
- The OS dependent stuff like icon files and batch files
- autoextract, which is the Java installer of Robocode for installing Robocode.
- installapplet, which is a Java Applet for installing Robocode from a webpage.
- build, which contains the main build script for compiling various parts of Robocode, but especially the installation/setup file for Robocode.
- CVSROOT, which is the root of the Robocode CVS, and which is automatically maintained by CVS.
The Robocode CVS Repository contains the following modules:
About the build
All output files of Robocode are created in the
1 | build/build |
folder.
The
1 | build/build.xml |
script contains various targets for building various parts for the Robocode distribution file. The default target is to build the Robocode setup file necessary for installing Robocode. The Robocode setup file contains all necessary files for installing and running Robocode including files from the
1 | robocodeextract |
module. The
1 | build/build.xml |
is also responsible of building the Javadoc files of Robocode. So if the Robocode API is changed, the Javadoc is automatically built and put in the distribution/setup file.
平均得分
(0 次评分)
评论: 0 | 查看次数: 532
发表评论
订阅
上一篇
|

文章来自:
标签: 




