Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add IntelliJ IDEA DSpace 6 / Services command line debugging info

...

Table of Contents
outlinetrue
stylenone

Instruction Video for Version v13 on MacOS

Widget Connector
urlhttps://www.youtube.com/watch?v=mrLl1qPsy6I

Installing IDEA

This guide covers version 11.1 of IDEA, which you can get from here: http://www.jetbrains.com/idea/. Instructions for installing & running can be found on the website and in the readme file included with the download.

...

  • From the main window, click "VCS", "Check out from Version Control", then "GitHub".
  • When it prompts you for a repository, click the "+" icon and enter the URL for the DSpace Repository in GitHub which you wish to work with (e.g. https://github.com/DSpace/DSpace.git OR if you have your own fork: https://github.com/\[your-username\]/DSpace.git).
    • IMPORTANT NOTE: If you plan to do a larger amount of DSpace development or local changes, you may wish to first "fork" the DSpace GitHub Repository (https://github.com/DSpace/DSpace) to your own GitHub account. This will create your own copy of the DSpace source code under your GitHub account (e.g. https://github.com/\[your-username\]/DSpace). You can then checkout your own forked repository to work from and commit local changes to (push changes to). For more information, see the GitHub help page on "Forking a Repo".
  • Next, select the "Remote Branch" you wish to develop on. A few hints: [[Copied from NetBeans, actually it is different for IntelliJ IDEA]]
    • Branches named "dspace-#_#_x" (e.g. dspace-1_8_x) are Bug Fix / Maintenance branches. So, the latest code in that bug-fix or maintenance release will be available on that branch. This code tends to be more stable overall. As such, we recommend most developers use the appropriate Bug Fix / Maintenance branch for their local development.
    • The branch named master is roughly equivalent to the old SVN Trunk. As such, it may not be as stable, but it includes the latest & greatest code which is being prepared for the next major release. Unless you know what you are doing, we do NOT recommend running this code in Production. It is essentially "unsupported" until it is officially released.
    • If you wish to work from a "tagged" (official release) version of DSpace (e.g. 1.8.2), you can download those releases as Tarballs/Zips from: https://github.com/DSpace/DSpace/tags You could then use that Tarball/Zip to import it into your own Git/GitHub or SVN repository as you see fit.

...

Once you have this set up, you can deploy DSpace, by selecting the tomcat deployment from the menu bar, and hitting the green play button next to it. Hit the play button on the opened dialog, and IDEA will deploy the applications at the context paths specified in this section.

DSpace 6 (Services) and debugging command line

Because I wanted to debug command-line main

Remove: <scope>provided</scope> from servlet-api in many pom.xml files.

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>

 

Add some dependencies to:

dspace-services/src/main/java/org/dspace/services/caching/CachingServiceImpl.java

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;

 

Navigate to dspace-api/src/main/java/org/dspace/app/launcher/ScriptLauncher.java, and click Run --> Edit Configurations...

Image Added

 

And fill in the Configuration of:

Main class: org.dspace.app.launcher.ScriptLauncher

VM options: -Ddspace.dir=/dspace -Ddspace.configuration=/dspace/config/dspace.cfg -Dservice.manager.spring.configs=/dspace/config/spring/api/*.xml

(I was debugging the checksum checker, so I passed the args that would go to /dspace/bin/dspace )

Program arugments: checker

Working directory: /dpsace/config

Environment variables: dspace.dir=/dspace/

Image Added

From then, you can click Run -> Debug "ScriptLauncher", or click the green bug button, and the debugger should start up.

Image Added

 

Tips

If you leave the "run" dialog boxes open at the bottom, you have a quick way to re-run the build and deployment tasks. The maven build can be re-run by clicking the green icon that looks like ">>", and likewise for the ant + tomcat deployment, except you'll have to click "stop" first, and wait for tomcat to shut down.

...