Contribute to the DSpace Development Fund

The newly established DSpace Development Fund supports the development of new features prioritized by DSpace Governance. For a list of planned features see the fund wiki page.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

If you are looking for ways to override specific classes or resources in DSpace (specifically in the backend), this page provides a guide for how to do so.

Additions module

Location: [dspace-source]/dspace/modules/additions/

This module may be used to store dspace-api changes, custom plugins, etc. Classes placed in [dspace-source]/dspace/modules/additions will override those located in the [dspace-source]/dspace-api

This module may be used to override classes across all webapps located in [dspace-source]/dspace/modules/ directory, as well as in the command line interface.  Therefore, this modules is for global overrides only. If you have overrides specific to a single webapp, use the "Maven WAR Overlays" option below.

Server Webapp Overlay

Location: [dspace-source]/dspace/modules/server/

This module overlay directory allows you to override any classes, resources or files available (by default) in the Server Webapp.  This includes overriding files of any of the following source directories:

  • [dspace-source]/dspace-oai/  (Bundled into the Server Webapp as a JAR)
  • [dspace-source]/dspace-rdf/  (Bundled into the Server Webapp as a JAR)
  • [dspace-source]/dspace-server-webapp/ (The Server Webapp itself)
  • [dspace-source]/dspace-sword/ (Bundled into the Server Webapp as a JAR)
  • [dspace-source]/dspace-swordv2/ (Bundled into the Server Webapp as a JAR)

Java classes place in [dspace-source]/dspace/modules/server/ will override classes (of the same path/name) in any of the above modules.

You can also override resources (i.e. any files under a /src/main/resources/ directory) which are embedded in one of the JARs by putting them under [dspace-source]/dspace/modules/server/src/main/resources/.  For example, to override the "[dspace-source]/dspace-oai/src/main/resources/templates/index.twig.html" file embedded in the dspace-oai.jar, you'd place your own version at [dspace-source]/dspace/modules/server/src/main/resources/templates/index.twig.html. This results in the resource/file being copied over into the WEB-INF/classes/ subdirectory of the "server" webapp, and in that location it will override any file of the same name embedded in a JAR (per Servlet Spec 3.0).

Rest (Deprecated) Webapp Overlay

Location: [dspace-source]/dspace/modules/rest

If you have chosen to install the deprecated REST API v6 webapp, you can similar override any classes/files of that separate webapp by just placing those files in the [dspace-source]/dspace/modules/rest/ directory

DSpace Source Release

If you have downloaded the 'dspace-src-release' (or checked out the latest DSpace Code via GitHub), there are two main build options that are available to you:

  1. Full Build: Running mvn package from the root [dspace-source]directory
    • 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-source] are recompiled/rebuilt.
  2. Quick Build: Running mvn package from the [dspace-source]/dspace/directory
    • 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-source]/dspace/modules/* (the Maven WAR Overlay directories)

Which build option you need to use will depend on your local development practices. If you have been careful to utilize Maven WAR Overlays for your local code/changes (putting everything under [dspace-source]/dspace/modules/*), then the Quick Build option may be the best way for you to recompile & reapply your local modifications. However, if you have made direct changes to code within a subdirectory of [dspace-source] (e.g. /dspace-api, /dspace-xmlui, /dspace-jspui, etc.) then you will need to utilize the Full Build option in order to ensure those modifications are included in the final WAR files.

  • No labels