You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by Apache Wiki <wi...@apache.org> on 2007/02/28 14:36:06 UTC

[Db-derby Wiki] Update of "BuildingDerby" by JohnHEmbretsen

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The following page has been changed by JohnHEmbretsen:
http://wiki.apache.org/db-derby/BuildingDerby

The comment on the change is:
Added info on how to build Derby using NetBeans 5.5

------------------------------------------------------------------------------
  '''Table of Contents'''
- [[TableOfContents(2)]]
+ [[TableOfContents(3)]]
  
  Feel free to add your tips for building Derby below.
  
@@ -46, +46 @@

  
  NOTE: Because some files are based on the JDBC 4.0 interfaces, there will be some files marked as having errors by Eclipse, since they do not conform to the version of Java set as your JRE System Library.
  
+ 
+ = Using NetBeans to Build Derby =
+ [[Anchor(UsingNetBeansToBuildDerby)]]
+ 
+ This section describes how to checkout and build Derby using [http://www.netbeans.org/ NetBeans 5.5]. (Similar steps should work on other !NetBeans versions as well, though there will most likely be some differences).
+ 
+ Steps 1 and 2 below describe checking out the Derby source code with Subversion from within !NetBeans. If you would rather like to build source code obtained by other means (for example distributed as an official release), or you have already checked out the source, proceed to Step 3.
+ 
+   1. Install Subversion
+ 
+     Set up Subversion on your machine if you have not already done so. This is described in the !NetBeans 5.5 IDE help under "''IDE basics''"->"''Working with Subversion''". 
+ 
+   1. Check out the Derby source code
+ 
+     '''Note:''' If you have already checked out the Derby repository outside of the IDE, !NetBeans will automatically recognize the files as being under version control; proceed to step 3. 
+ 
+     I. Use the "''Subversion''"->"''Checkout...''" menu item. Enter the URL for the repository (folder) you want to check out in the "''Repository URL''" field. Normally this would be the URL for the latest development trunk, https://svn.apache.org/repos/asf/db/derby/code/trunk/. If you want to build a specific branch instead, you may browse to the desired folder after clicking the "''Next''" button, or you may specify the branch URL directly (see [http://db.apache.org/derby/dev/derby_source.html#Derby+source+code the Derby web site] for further info). Leave the user and password fields blank (unless you are a committer and want to commit patches using !NetBeans' Subversion interface). Enter your proxy information if you are using a proxy to connect to the Internet. Click "''Next''".
+ 
+     I. Verify that the correct folder shows up in the "''Repository Folder(s)''" field. For trunk, this would be db/derby/code/trunk. Specify the local folder in which you want to place your working copy of the repository, for example /home/user/dev/derby/svn. Leave other fields/checkboxes blank. Click "''Finish''".
+ 
+     I. Observe the progress in the "''Output''" section of the !NetBeans window. This may take a few minutes. You will be prompted to create a new Project once the checkout has finished.
+ 
+   1. Add Derby as a !NetBeans Project
+ 
+     (Parts of the following description may be specific for trunk, but the process should not be too different for branches, releases or snapshots).
+ 
+     I. If you did not check out Derby via !NetBeans, or for some other reason have not been prompted to create a Project based on the checked out sources, select "''File''"->"''New Project...''" on the menu.
+ 
+     I. Select Category "''General''" and Project "''Java Project with Existing Ant Script''". Click "''Next''".
+ 
+     I. For "''Location''", browse to the trunk folder of your working copy of the repository (or, if you are not using SVN, the top level directory of your source distribution, containing the top level build.xml file). !NetBeans will automatically fill in the field for "''Build Script''" (e.g. .../trunk/build.xml) when you specify the correct location. Specify a Project Name (for example "!DerbyTrunk") and a !NetBeans Project folder (to avoid mixing repository/source files with !NetBeans project files, you may want to use a folder in a different location than the Derby source, but this is not a requirement). Leave "''Set as Main project''" checked if you want to (this is easy to change later on). Click "''Next''".
+ 
+     I. For the Build and Run actions, select the following ant targets:
+       * Build Project: {{{all}}}
+       * Clean Project: {{{clobber}}}
+       * Generate Javadoc: {{{javadoc}}}
+       * Run Project: <blank>
+       * Test Project: {{{junitreport}}}
+ 
+     You may specify additional targets later, as needed. Click "''Next''".
+ 
+     I.#5 Click the "''Add Folder...''" button next to the "''Source Package Folders''" area. Select and add all the folders within the "java" folder (or just the "java" folder itself; the only difference is how it looks in your Project view). 
+ 
+     I. Select source level "''JDK1.4''" if you are working with the trunk or a Derby version number that is 10.3 or higher. Select "''JDK 1.3''" if you are working with a branch for (or release/snapshot of) Derby 10.2 or older. Click "''Next''".
+ 
+     I. Uncheck the "''Separate Classpath for Each Source Package Folder''" checkbox. 
+ 
+     I. Read [http://svn.apache.org/repos/asf/db/derby/code/trunk/BUILDING.txt BUILDING.txt] in the top level source folder in order to identify which external jars you need in order to build Derby, and the contents and location of your ant.properties file, as well as other requirements (Java versions, etc.). Place the required jars in the location(s) indicated in BUILDING.txt. For Derby versions 10.2 or newer this includes for example junit.jar.
+ 
+     I. (Optional) The following is useful in order to enjoy the full set of !NetBeans features, such as code completion and refactoring, but is not necessary in order to build Derby: Use the "''Add JAR/Folder...''" button to select and add the external jars you need (usually located in .../tools/java/) to your "Java Sources Classpath". See also http://db.apache.org/derby/dev/derby_source.html for details. 
+     
+     I. Click "''Finish''".
+ 
+   1. Specify the ant.library.dir property
+     Select "''Tools''"->"''Options''" from the menu. Enter the "''Miscellaneous''" section and expand the "'''Ant'''" line. Click "''Manage Properties...''" and add the line
+     {{{
+     ant.library.dir=<path>
+     }}}
+     where {{{<path>}}} is the full path to the lib folder of your ant installation. !NetBeans bundles a version of Ant which should be good enough for Derby, so you may specify the lib/ folder of the bundled ant (for example {{{/opt/netbeans-5.5/ide7/ant/lib}}}).
+ 
+     Alternatively, you can specify this property in your ant.properties file instead.
+ 
+   1.#5 Add a target for building the jar files (optional)
+ 
+     Right click your Derby project in !NetBeans' Projects view and select "''Properties...''". Under "''Build and Run''", click the "''Add''" button. Click in the field below the "''Ant target''" heading and select the {{{buildjarsclean}}} target (this target will delete any old jars before building new ones). Click in the field below "''Label''" and type the IDE command name you want to use for this target, for example "Build clean jars". Set focus (click) somewhere else in the window to save your label name. Click "''OK''".
+ 
+   1. Build the Derby classes
+ 
+     If your Derby Project is set as main project: Press '''F11''', or select the "''Build''"->"''Build Main Project''" menu item, or right-click your Derby project and select "''Build Project''".
+ 
+     If your Derby project is not set as main project, right-click your Derby project and select "''Build Project''".
+ 
+     If the build fails, right-click the Derby project and select "''Clean Project''" before you try again (after fixing the issues (errors) reported) - or run "''Clean and Build Project''" instead on the next try. If you get an error message complaining about not finding ant classes, revisit Step 4. Warnings can be ignored. The "''BUILD SUCCESSFUL''" message indicates that all went well.
+ 
+   1. Build the Derby jars (optional)
+ 
+     Right-click your Derby project and select the label you created in Step 5. Depending on the setting in your ant.properties file, the Derby jars will end up in the jars/sane/ or the jars/insane/ directory.
+ 
+   1. Congratulations, you have now built Derby! Now it's time to update the "Output" and "Java Sources Classpath" properties of your Derby project if needed for code completion, debugging, etc. and start hacking some Derby code (or create tests, or review code, or...)!
+