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 (moved to "Java" section in newer NetBeans versions).
    • Select the "Maven" tab.
    • Modify the "Maven Home" field. 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 "Bundled" Maven, then you'll want to fill out the "Maven Home" field with the location of your external installation of Maven.
    • In the middle of this page, you may 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 ~/.m2/
      • On Windows, it should be located at C:\Documents and Settings\username\.m2 (Windows XP) or C:\Users\username\.m2 (Windows 7)
    • All the other Maven settings should be fine as their defaults. Press "OK" to save your changes.

...

The following are a few hints/tips which you may want to utilize to ease your development processes with NetBeans and GitHub:. Much more info about DSpace + GitHub development at Development with Git.

  1. Fork your own Repo to store your local changes: As recommended above, you really should think about forking your own copy of the DSpace GitHub repository. As GitHub describes in their "Fork a Repo" guide, forking lets you create your own personal copy of the codebase. It not only provides you a place to put your local customizations. It also provides an easier way to contribute your work back to the DSpace community (via a GitHub Pull Request).
  2. For easier Fetch/Merge, setup an "upstream" repository location: This is only really relevant if you have your own personal "fork" (see #1). If you have forked the DSpace GitHub repository, then you may want to setup an "upstream" remote that points at the central DSpace GitHub repository. This is described in more detail in the GitHub "Fork a Repo"guide. Perform the following:
    • On the command-line, change directory to your local machines' cloned DSpace git repository, which is also your DSpace source directory (e.g. cd [dspace-src])
    • Run the following 'git' command from that directory:

      Code Block
      git remote add upstream git://github.com/DSpace/DSpace.git

      (Technically you can name it something other than "upstream". But, "upstream" is just the GitHub recommended naming convention).

    • For more information about how this comes in handy, see the section below on "#Fetch & Merge Example via NetBeans".

...

  • Select the project for the Web Application you wish to run through Tomcat (e.g. "DSpace XML-UI (Manakin) :: Web Application Resources" 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. The following is an example on Windows, assuming that you've installed DSpace to "C:/dspace/":
      • For DSpace 3.0 or above, set the property:  dspace.dir=C:/dspace/ (make sure to include this entire line – also, do NOT include quotes around the file path)
      • For DSpace 1.8.x or lower, set the property: dspace.config=C:/dspace/config/dspace.cfg (make sure to include this entire line – also, do NOT include quotes around the file path)
  • Finally, click "OK" at the bottom to save all your new project settings.

...

  • Select the project for the Web Application you wish to run through Tomcat (e.g. "DSpace XML-UI (Manakin) :: Web Application Resources" 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. 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:/dspace/":
      • For DSpace 3.0 or above, set the property:  dspace.dir=C:/dspace/ (make sure to include this entire line – also, do NOT include quotes around the file path)
      • For DSpace 1.8.x or lower, set the property: dspace.config=C:/dspace/config/dspace.cfg (make sure to include this entire line – also, do NOT include quotes around the file path)
  • 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".

Run DSpace's bundled Solr server from NetBeans

As noted in the examples above, for most modules you should be running theweb application via the main source code directory (e.g. [src]/dspace-xml/ for XMLUI).

However, for the bundled Solr module to function properly, you need to run the "DSpace SOLR :: Local Customizations" project (i.e. [src]/dspace/modules/solr/) INSTEAD.  You'll still need to customize its "Actions" (like detailed above) to set the property dspace.dir=[installation-directory].

Integrate DSpace Javadoc within Netbeans

...