Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • First, install Maven:
    • For most Linux distributions, you should be able to just install the Maven client available in your distribution's repositories.
    • For all other operating systems, you can install the latest version from the Apache Maven site.
  • Configure Netbeans to use your external Maven:
    • Go to the "Tools" menu, and select "Options" (on OS/X, this is "NetBeans" -> "Preferences")
    • Select the "Miscellaneous" section.
    • Select the "Maven" tab.
    • Directly under the "External Maven Home" field, you'll see a line that says "Using Default Maven Version:____". It's possible that Netbeans will already see your external version of Maven (if it's in your PATH). However, if it says that it is using the "embedded maven", then you'll want to fill out the "_External Maven Home" field with the location of your external installation of Maven.
    • Down near the bottom, you also need to fill out the location of your "Local Repository". This should be the location of the ".m2" directory under your user's home directory.
      • On Linux and OS/X, it should be located at Code Block ~/.m2/
      • On Windows, it should be located at Code BlockC:\Documents and Settings\username\.m2 (Windows XP) or Code BlockC:\Users\username\.m2 (Windows 7)
    • All the other Maven settings should be fine as their defaults. Press "OK" to save your changes.

...

  • Under the 'Team' menu, go to 'Subversion' and then 'Checkout'. Enter the URL for the DSpace Subversion repository: http://scm.dspace.org/svn/repo/dspace, and click on the next button.
  • Next to 'Repository Folder(s)', click on 'Browse', and browse to the version of DSpace you wish to checkout. A few hints:
    • Stable, tested versions of DSpace are available under tags (e.g. Code Blocktags/dspace-1_5_2)
    • Latest Bug Fixes (though slightly less stable) are available under branches (e.g. Code Blockbranches/dspace-1_5_x)
  • Unstable code is available on trunk. It is*not recommended that you checkout trunk unless you know what you are doing!
  • Choose a local folder to checkout to (or leave the default entry), and leave the 'Scan for NetBeans projects after Checkout' option selected, and click on 'Finish'.
    When NetBeans completes the checkout, it will pop-up a dialog telling you that it found projects during the checkout. Choose 'Open Project' from the dialog. Select all the projects that you wish to open (hold down *ctrl to select multiple), and click the OK button.

...

Remember, you build DSpace from within the dspace sub-folder (e.g.

...

<dspace-src>/dspace

...

). In NetBeans, this project is named "DSpace Assembly and Configuration", based on the name specified in its Maven configuration file (pom.xml).

...

  • Right click in your "Projects" window
  • Select "Open Project", and browse to the Code Block[dspace-src]<dspace-src>/dspace/ directory. You should see the Project Name (on the right) specified as "DSpace Assembly and Configuration".
  • Click the "Open Project" button.

...

  1. Right-click on the "DSpace Assembly and Configuration" project
  2. Select the "Build" option (alternatively you may select "Clean & Build" to first clean out previous builds).
    You should be able to watch the status in the "Output" window at the bottom of NetBeans. The end result is that DSpace is built into the Code Block[dspace-src]<dspace-src>/dspace/target/dspace-1.5.x-build.dir/ directory (you can verify this from the "Files" window in NetBeans, if you wish).

...

  • Right click on the project
  • Select "Show and Resolve Problems..." (near bottom of pop-up menu)
  • Click on "Download Libraries" (assuming the problem is that "Some dependency artifacts are not in the local repository").
    NetBeans should then use Maven to find all the DSpace dependencies and download them to your local Maven repository (in your user's Code Block~/.m2/ folder)

Install DSpace normally

...

  1. The easiest way to install DSpace may be to just follow the normal installation procedure in the DSpace System Documentation. NetBeans doesn't seem to have an efficient way to perform this installation, so it's easiest to just do it from the command line, as normal.
  2. Alternatively, you can use NetBeans to run the Code Blockant fresh_install command as follows:
    • Click over to the "Files" tab in the left hand window
    • Browse under the "DSpace Assembly and Configuration" project. You are looking for the Code Blocktarget/dspace-[version]<version>-build.dir/build.xml Ant configuration file.
    • Right click on the Code Blockbuild.xml file and select "Run Target" => "fresh_install"
      • The above command will perform a fresh install of DSpace based on the settings specified in your Code Blocktarget/dspace-[version]<version>-build.dir/config/dspace.cfg file.
    • Finally, return to the normal installation procedure in the DSpace System Documentation for the commands to setup an initial DSpace Administrator, etc. from your newly created
      Code Block
      [dspace]
      <dspace> installation directory.

Run DSpace from NetBeans with Tomcat

...

Once NetBeans knows about Tomcat, you can run your DSpace webapps through this Tomcat integration and even perform debugging of your DSpace web application. To do this, we'll need to perform some basic configuration of the web application project in NetBeans.

  • Select the project for the Web Application you wish to run through Tomcat (e.g. "DSpace XML-UI (Manakin) :: Web Application Resources (war)" for the XMLUI). This project*must* be a "(war)" based project, as Tomcat only runs WAR files.
  • Right click on your selected project and click "Properties"
  • From the Properties window, select the "Run" category.
    • From these Run settings, you'll want to specify the Server which this application should run on. Select your newly configured Tomcat server.
    • Also, specify a "Context Path". This should be the ending path on the URL. For example, specifying "/xmlui" will mean your web application will be available from "http://localhost:8080/xmlui"
  • Now, click over to the "Actions" category on the left.
    • You'll see a list of Actions on the right. Click on the "Run Project" action (as this is the one used to run your web application).
    • In that Action's "Set Properties" section, add a property to point it to your DSpace installation's configuration file (dspace.cfg). The following is an example on Windows, assuming that you've installed DSpace to "C:/Program Files/dspace-1_5/":
      • dspace.config="C:/Program Files/dspace-1_5/config/dspace.cfg" (make sure to include this entire line)
  • Finally, click "OK" at the bottom to save all your new project settings.

...

Debugging a DSpace web application involves mostly the same setup as running it. The main difference here is that you need to configure the "Debug Project" settings (rather than the "Run Project" settings). So, similar to above, do the following:

  • Select the project for the Web Application you wish to run through Tomcat (e.g. "DSpace XML-UI (Manakin) :: Web Application Resources (war)" for the XMLUI). This project*must* be a "(war)" based project.
  • Right click on your selected project and click "Properties"
  • From the Properties window, select the "Actions" category on the left.
    • You'll see a list of Actions on the right. Click on the "Debug Project" action (as this is the one used to debug your web application).
    • In that Action's "Set Properties" section, add a property to point it to your DSpace installation's configuration file (dspace.cfg). Make sure to keep all existing properties in tact, and just add your new property. The following is an example on Windows, assuming that you've installed DSpace to "C:/Program Files/dspace-1_5/":
      • dspace.config="C:/Program Files/dspace-1_5/config/dspace.cfg" (make sure to include this entire line)
  • Finally, click "OK" at the bottom to save all your new project settings.

...

  • Right click on the project, and select "Debug". This should re-build the project, start-up Tomcat in debug-mode, and open up your application in your default web browser. You should see a "Debugger Console" appear.
  • You can now add breakpoints to areas of your code. The debugger should automatically stop at those points and let you step through your code line-by-line.
    • * Note: Occasionally, the first time you perform debugging, the debugger doesn't connect properly with your Tomcat Server. If you find it's not stopping at your breakpoints, you may wish to "Attach" the debugger manually:
    • From the "Debug" menu, select "Attach Debugger.."
      • For the "Connector", specify "SharedMemoryAttach".
      • For the "Name", specify "tomcat_shared_memory_id" (without the quotes).
      • Click "OK" to save these settings
    • Finally, verify that Tomcat is specifying this "tomcat_shared_memory_id" field.
      • Go to the "Tools" menu and select "Servers"
      • Click on your Tomcat Server, and visit the "Startup" tab.
      • Make sure the "Shared Memory Name" setting is selected, and that the value is also "tomcat_shared_memory_id".