• These instructions assume you are using DSpace 1.5.x (or higher) in the NetBeans IDE.
  • DSpace 1.4.x and previous are not covered.

Table of Contents:

Video Walkthrough

João Rocha da Silva kindly posted a video walkthrough of setting up DSpace + Netbeans on YouTube:

Installing NetBeans

NetBeans 7.1 (or latest version) is recommended for both performance and features (plus, >7.1 includes Git support out-of-the-box). Download it from http://www.netbeans.org/.

Choose either the 'Java SE' or 'Java' version. The 'Java' version has more features (such as editing JSPs), and although the GlassFish / Tomcat runtimes will be downloaded, you don't have to install them. If you choose the 'Java SE' version, you can always install those extra features later (as plugins).

Now simply run the downloaded installer.

If you are running on Linux/Unix, you will need to make the downloaded script executable (e.g. chmod +x netbeans-[version]-full-linux.sh).

Git Plugin / Support

As long as you are running NetBeans 7.1 or above, Git support comes pre-installed in NetBeans.

However, if you are running NetBeans 7.0, you can install the "Git" plugin by going to "Tools -> Plugins" and finding the plugin named "Git" under the list of "Available Plugins".

If you plan to also occasionally run Git commands from your command-line, you may wish to install Git on your operating system:

If your institution plans to instead use a local Subversion repository for your local development, you can do so (you will just need to download the DSpace Source Code and import into your local subversion repository).
Subversion support is already included in NetBeans. However, it requires that the command line client is installed and available on your local machine.

  • For most Linux distributions, you should be able to just install the Subversion client available in your distribution's repositories.
  • For Windows, there is now a 'Bundled Subversion Client for Windows' Plugin which you can install from within NetBeans
    • Go to Tools -> Plugins to install the plugin.
  • For Windows/RedHat/Solaris, CollabNet also offers free Subversion downloads that are specifically tested with NetBeans: http://www.collab.net/downloads/netbeans/ (Free to download, but they require that you register first. Registration is also free, but requires a valid email address)

Maven Support

As long as you are on a recent version of NetBeans (> 6.7), Maven support is included out-of-the-box.

Integrate an External Installation of Maven

Although not required, it is recommended to install an external version of Apache Maven. This will ensure that you are using a version of Maven which DSpace supports. (You should check the latest pre-requisites if you are using a later version of DSpace) However, if the version of Maven that is bundled with NetBeans is a supported version, you are welcome to use it.

If you wish to integrate an external install of Maven:

Checkout DSpace from GitHub

For more generic information about working with Git/GitHub in NetBeans, see the NetBeans Git Guide


If you need help/tips/resources on DSpace development with Git/GitHub, or just tutorials on Git in general, you may want to check out our DSpace Development with Git page.

NetBeans makes the checkout and configure process easy, as it does nearly everything for you.

After the clone has completed, you'll notice NetBeans considers each DSpace Maven "module" to be a separate project. So, you'll see separate projects for "DSpace XML-UI" and "DSpace JSP-UI", even though these are all cloned from the same source code.

Git/GitHub Hints & Tips

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:

Fetch & Merge Example via NetBeans

This assumes you've followed the #Git/GitHub Hints & Tips listed above, and have forked your own personal copy of DSpace's GitHub as well as setup an "upstream" remote link. This is just one example of how you can perform these tasks.

  1. Fetch changes from DSpace Main GitHub:You fetch (and later merge) changes that have occurred in the central DSpace GitHub Repository:
  2. Merge changes into your Local Git Repo:Remember, "fetching" changes just brings them into your local-machine's copy of the Git repository. You'll then need to merge those changes with yours and push the changes back to your personal public GitHub repository.
  3. Quick Status of Local Git Repo:If you want to see what happened, you can look at the "Status" information:
  4. Push Merged Code up to your Personal GitHub Repo:Finally, assuming all went well, you can push your changes back up to GitHub into your public personal repository:

Build DSpace from NetBeans

As of DSpace 1.8, there are now two options to building DSpace Source Code as detailed in the Advanced Customisation Documentation. They are as follows:

  • Full Build: Running mvn package from the root [dspace-src] directory (Or run "Build" on the "DSpace Parent Project" in NetBeans). This option will rebuild all DSpace modules from their Java Source code, then apply any Maven WAR Overlays. In other words, all subdirectories of [dspace-src] are recompiled/rebuilt.
  • Quick Build: Running mvn package from the [dspace-src]/dspace/ directory (Or run "Build" on the "DSpace Assembly and Configuration" project in NetBeans). This option performs a "quick build". It does not recompile/rebuild all DSpace modules. All it does is rebuild and re-apply any Maven WAR Overlays to the previously compiled source code. In other words, the ONLY code that will be recompiled/rebuilt is code that exists in [dspace-src]/dspace/modules/* (the Maven WAR Overlay directories)

As described in the note above, as of DSpace 1.8, there are two options to build DSpace. Traditionally (before 1.8), you could only build DSpace from 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).

If you do not see the proper project opened (NetBeans may not have opened it by default), then open it manually:

Once that project is opened, you can build DSpace by doing the following:

  1. Right-click on the 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 [dspace-src]/dspace/target/dspace-[version]-build.dir/ directory (you can verify this from the "Files" window in NetBeans, if you wish).

After building DSpace for the first time, you may still see red exclamation point icons (!) next to some projects. In most cases, this is caused by NetBeans being unable to locate some of the DSpace third-party dependencies on your local file system. To fix this problem, do the follow for each project which has a red icon next to it:

By default, NetBeans builds all Maven-based projects using mvn install instead of mvn package (which DSpace recommends). The resulting build is identical, except that the "install" command will take longer as it also attempts to verify that all source file headers match our DSpace license. If you'd like to speed up your NetBeans build & avoid these license checks you can do the following:

  1. Right click on the project you are attempting to Build (e.g. "DSpace Assembly and Configuration"), and select "Properties"
  2. Go to the "Actions" category on the left
  3. Select the "Build project" action.
  4. In the "Execute goals" change "install" to "package"
  5. Now select the "Clean and Build Project" action
  6. In the "Execute goals" change "clean install" to "clean package"
  7. Finally, select the "Build with Dependencies" action
  8. In the "Execute goals" change "install" to "package"
    Now, for that project, each time you run any of the 3 build commands (Build, Clean & Build, or Build with Dependencies) NetBeans will use the Maven 'package' command instead of the 'install' command. You'd have to do this customization for any NetBeans project that you want to build using those commands.

As an alternative, you could also create your own custom NetBeans commands (which can be run across any/all projects) by doing the following:

  1. Right click on any project.
  2. Select "Custom -> Goals..."
  3. In the "Goals:" field type "package"
  4. Select "Remember as:" (at bottom) and enter in "Package" (or some name you will remember)
  5. Click OK
    Now, you can right click on any project, and go to "Custom -> Package" to run a Maven "package" of that project. You can use this new custom command instead of the default "Build" command.

Install DSpace normally

After building DSpace, we need to use Apache Ant to install it. Unfortunately, this is an area where NetBeans is not very helpful (as we built DSpace using Maven, it will continue to assume all of our projects are Maven-based projects).

You have two options here:

  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 ant fresh_installcommand as follows: (You need to create a database and a database owner first.)

Run DSpace from NetBeans with Tomcat

Once you have DSpace installed, you can run any DSpace web application (XMLUI, JSPUI, SWORD, LNI, etc.) from NetBeans after you integrate NetBeans with Apache Tomcat.

Integrate an External Installation of Tomcat

If you have Tomcat installed separately from NetBeans, you'll need to tell NetBeans where it's located.

Run DSpace WebApp using Tomcat Integration

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.

Now, test it out!

Right click on the project, and select "Run". This should re-build the project, start-up Tomcat, and open up your application in your default web browser.

BONUS: If you haven't already noticed, NetBeans will auto-rebuild your project in real-time while Tomcat is running. This means, if you want to edit a CSS or XSLT (for the XMLUI), you can edit it and just refresh your web browser. Your changes should show up in the browser almost immediately. (That being said, there are times when you will still have to restart Tomcat in NetBeans – usually after you haven't restarted it in a long time, or after an update to Java source code)

Debug DSpace WebApp using Tomcat Integration

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:

Now, we'll start our web application in Debug-mode. (Make sure to stop Tomcat first, if it is currently running)

Run DSpace's bundled Solr server from NetBeans

As noted in the examples above, for most modules you should be running the web 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

This section provides instructions for generating the DSpace javadoc and its integration within Netbeans. Its aim is to allow developers to refer to the current DSpace Library API calls, and understanding its uses from within the IDE.