cogFetches information from a JIRA server and displays them as a table, list or enumeration
Developed by

Vincent Massol, XWiki Development Team

Active Installs89
1 Votes
LicenseGNU Lesser General Public License 2.1

XWiki 6.4+

Installable with the Extension Manager


Fetches information from a JIRA server and displays them as a table, list or enumeration.

If you need to connect to a JIRA instance that requires authentication, you'll need to install the JIRA Administration extension and configure some JIRA server id in there, which you can then specify using this macro's id parameter (see below).


{{jira url="..." id="..." source="..." style="..." fields="..." fieldNames="..." parameters="..." maxCount="..."}}
...content describing the JIRA issues to return...


Parameter NameMandatory?Default ValueDescription
idaccept or urlN/ASince 8.2 Configuration id of the JIRA server as defined using the JIRA Administration. This is recommended over using the url parameter for 2 reasons:
  • it's a more flexible solution (for example if you change the JIRA URL one day, you'll need to change it only in one place without having to change all the jira macro calls).
  • it supports authenticating to a JIRA instance
urlaccept or idN/AURL to your JIRA server. (example: When specified, takes precedence over the id parameter if also specified. This parameter is mostly kept for backward-compatibility and in general it's recommended to use the id (see the documentation of the id parameter above).
sourcecancellistDefines how the list of JIRA issues is specified. Allowed values: list and jql. With the list value, the user must specify a discrete list of JIRA issue ids in the macro content, one per line. The user can also specify a Note separated by the pipe symbol from the Issue key. With the jql value, the user specifies a JQL Query in the macro content. 
stylecanceltableSpecifies the way you want the results displayed. Allowed values are table, list and enum
tabletype, key, status, summary, created
liststatus, key, summary
enumstatus, key
Specifies the ids of the fields you want to display for each JIRA issue. If not defined then uses the defaults which depend on the style defined. Since 8.3 Custom JIRA fields are supported and are specified using their display name. The new format is id:label!type,... where:
  • id: The id of the field
  • label: (optional) Replaces the now deprecated fieldNames parameter. It is used by the table style as the display value for the field in the table header. Useful to customize field names, or if you want to internationalize your macro.
  • type: (optional) Specifies an explicit type for the field. This is used when no specific displayer exists for the field, in which case a displayer specific to the specified type is used. When no displayer exist, a default text displayer is used (the field value is then displayed as is with no special formatting). By default 2 type displayers are provided: url (creates a link on the field value that is considered as a URL) and html (consider that the field value is HTML and inject that HTML as the displayed value for the field).
createdCreated Date
updatedUpdated Date
resolvedResolved Date
fixVersionFixed In
versionAffected Versions
Deprecated in 8.3 Overrides the field names. This is used only by the table style, in case you want custom field names, or if you want to internationalize your macro.
parameterscancelN/ASince 8.3 Specifies parameters for the various sources, displayers and field displayers. For example the url field displayer type supports the field.url.label parameter to customize the label of the link for link values.
maxCountcancelDefined in JIRASince 8.4 the maximum number of JIRA issues to display.

The list of valid JIRA fields can be found on the JIRA Advanced Searching page. In addition we've added a note field which corresponds to the notes you can add as part of the macro content when using a list source (see the example below).


  • JIRA Macro using defaults:
    {{jira url=""}}


  • JIRA Macro as Table using custom fields and custom field names:
    {{jira url="" style="table" fields="type, key, summary, status, assignee, created, note" fieldNames="'Issue type', 'Issue Id', 'Short Description', 'Issue Status', 'Person to Fix this', 'Creation Date', Notes" }}
    XWIKI-2484|Hard to fix
    XE-291|Easy to fix
    XWIKI-3677|This issue takes too long. Need to find a solution ASAP


  • JIRA Macro as List with default fields:
    {{jira url="" style="list"}}


  • JIRA Macro as Enum with default fields:
    {{jira url="" style="enum"}}


  • JIRA Macro as Table using JQL with default fields:
    {{jira url="" style="table" source="jql" }}
    (project in (XWIKI) and fixVersion in ("3.2 M1", "3.2 M2", "3.2 M3", "3.2 RC1", "3.2")
    and resolution in ("Fixed")) or (project in (XE)
    and fixVersion in ("3.2 M1", "3.2 M2", "3.2 M3", "3.2 RC1", "3.2")
    and resolution in ("Fixed")) or (project in (XRENDERING) and fixVersion in ("3.2 M1", "3.2 M2", "3.2 M3", "3.2 RC1", "3.2")
    and resolution in ("Fixed")) or (project in (XCOMMONS) and fixVersion in ("3.2 M1", "3.2 M2", "3.2 M3", "3.2 RC1", "3.2")
    and resolution in ("Fixed")) or (project in (XEM) and fixVersion in ("3.2 M1", "3.2 M2", "3.2 M3", "3.2 RC1", "3.2"))



If you get an error such as: Server returned HTTP response code: 400 for URL: [...] this usually means that you there's at least one JIRA issue that requires some permission that user used by the JIRA Macro doesn't have (typically this can happen if you've set some confidential issues). Make sure to use a user that can view all issues.


There are 3 ways to extends the Macro:

  • Add a new Style. You'll need to write a Component and implement the org.xwiki.contrib.jira.macro.JIRADisplayer interface:
    public interface JIRADisplayer
         * Displays the passed JIRA issues.
         * @param issues the issues to display
         * @param parameters the macro parameters specified by the user; can be used to specify displayer-specific
         *        configuration data (for example displayers allows the user to specify the list of JIRA issue fields to
         *        display
         * @return the list of Blocks rerpesenting what to display

        List<Block> display(Collection<Element> issues, JIRAMacroParameters parameters);
  • Add a new Source. You'll need to write a Component and implement the org.xwiki.contrib.jira.macro.JIRADataSource interface:
    public interface JIRADataSource
         * @param macroContent the macro content which contains the source definition
         * @param parameters the macro parameters which can contain source-specific configuration information
         * @return the list of matching JIRA issues
         * @throws MacroExecutionException in case of an error while getting the JIRA data

        Collection<Element> getData(String macroContent, JIRAMacroParameters parameters)
           throws MacroExecutionException;
  • Add new Field Displayers. For each field for which you wish to have a custom field displayer, you'll need to write a Component, implement the org.xwiki.contrib.jira.macro.JIRAFieldDisplayer interface and use a Role being the field name:
    public interface JIRAFieldDisplayer
         * Generate Blocks to display the passed field.
         * @param field the field to display
         * @param issue the JIRA issue as an XML element, can be used to extract information useful to generate the display
         * @param parameters the macro parameters which can contain field displayer-specific configuration information
         * @return the list of Blocks to display the passed field

        List<Block> displayField(JIRAField field, Element issue, JIRAMacroParameters parameters);

Since 8.3 Sources, Displayers and Field Displayers can support configuration parameters defined in the passed JIRAMacroParameters variable type. A best practice is to follow these conventions:

  • source.<hint>.* for JIRADataSource parameters
  • field.<hint>.* for JIRAFieldDisplayer parameters. For example field.url.label
  • display.<hint>.* for JIRADisplayer parameters

Example using a wiki component

Custom Source, Displayer, and Field Displayers are XWiki Components and as such can be developed in Java but also as wiki components in wiki pages as shown below.

This example contributes a new field type named lien that displays a JIRA value as a link with a custom label of Lien.

  1. Create a page XWiki.LienJIRAFieldDisplayer (the page can be named as you wish) and add an XWiki.ComponentClass xobject in it:

    Note that since we want to add a new field type, the component hint has to be of the form type/<field type>, such as type/lien.

  2. We want a dependency on the default org.xwiki.contrib.jira.macro.JIRAFieldDisplayer component implementation in order to access the JIRA field value. Thus we add a XWiki.ComponentDependencyClass xobject:


  3. Last, we need to implement the component code, i.e. the displayField(...) method:


    Source code (so that you can copy-paste it if you need to):

    import org.xwiki.rendering.block.*
    import org.xwiki.rendering.listener.reference.*

    def field = xcontext.method.input.get(0)
    def issue = xcontext.method.input.get(1)
    String text = xcontext.method.defaultDisplayer.displayField(field, issue).get(0).getProtectedString()

    def reference = new ResourceReference(text, ResourceType.URL)
    def labelBlocks = [new WordBlock("Lien")]
    xcontext.method.output.value = [new LinkBlock(labelBlocks, reference, true)]

    Note the xcontext.method.defaultDisplayer notation which accesses the component defined in the previous step above. The returned method value is defined using the xcontext.method.output.value call.

Example using the new field type:

{{jira ... fields="..., somefield:lien, ..."}}...{{/jira}}

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.


Dependencies for this extension (org.xwiki.contrib.jira:jira-macro-platform 8.3):

Tags: jira
Created by Sorin Burjan on 2011/11/02 15:48

Get Connected