Deploying Plugins in XNAT

Installing plugins in XNAT 1.7 is as simple as installing a properly formatted jar in the XNAT plugins folder. 

Make sure no one is logged in and using your XNAT before taking these steps. See Administering Users for notes on how to view active user sessions.

Step-by-step guide

This presumes you have a valid plugin jar to install. Unless the documentation for a specific plugin tells you otherwise, the standard way to create a jar for an XNAT plugin is to navigate to the root folder of the plugin code and run the following:

$ ./gradlew jar

After this process completes, a jar file will be created in the build/libs subdirectory. 


Step 1: Shut Down Tomcat

If your web application is currently running, shut it down. SSH into your XNAT web application, then execute the following: 

$ sudo service tomcat7 stop

Step 2: Install Your Plugin JAR file

Copy your plugin jar file into the folder ${xnat.home}/plugins. The location of xnat.home depends on your system configuration. In the default XNAT Vagrant machine, this is located in /data/xnat/home.

Step 3: Start Up Tomcat

Start Tomcat back up.

$ sudo service tomcat7 start

XNAT will take a moment to unpack and incorporate the new plugin before the application comes back online. You can monitor the progress of the application as it builds by following the catalina.out log file. 

$ tail -f /var/lib/tomcat7/logs/catalina.out

When you see a message in the log file like INFO: Server Startup in 105462 ms, your XNAT is ready to use again. 

An XNAT plugin can consist of a number of different components, including:

  • Data types in the form of XSD files
  • Velocity templates
  • JavaScript files
  • CSS style sheets
  • Java code for REST services, Velocity screen or action classes, Spring MVC controllers, services, database entities, and more

$label.name