Integrating IntelliJ IDEA
Revision as of 14:07, 24 January 2019 by Sabine Teubner (talk | contribs)
This article is part of the Getting Started Section. It describes how to run XPath/XQuery code from within the IntelliJ IDEA IDE.
Preparations
The following steps apply to all operating systems:
- Install either version of IntelliJ IDEA: the Community or Ultimate edition.
- Download your favorite BaseX distribution (JAR, ZIP, EXE).
- Start BaseX (see Startup).
- Create a BaseX database (see Databases).
XQuery Support + MarkLogic Debugger
This section focuses on Grzegorz Ligas' XQuery Support plugin.
Installation
After installing IntelliJ IDEA and BaseX, install the XQuery Support plugin by one of the following methods:
From the Start Screen
- Start IntelliJ IDEA and select Configure→Plugins.
- In the Plugins window select the tab Marketplace.
- Type "XQuery Support" into the Search plugins in marketplace field.
- Click the Install button below the XQuery Support + MarkLogic Debugger plugin.
- You will be prompted to restart IDEA to load the new plugin.
From the IntelliJ IDEA Menu
- Select Settings/Preferences in the IntelliJ IDEA menu.
- In the Settings/Preferences window select Plugins.
- In the Plugins window select the tab Marketplace.
- Type "XQuery Support" into the Search plugins in marketplace field.
- Click the Install button below the XQuery Support + MarkLogic Debugger plugin.
- You will be prompted to restart IDEA to load the new plugin.
Setting Up
File Extensions and XQuery Flavor
- Start IntelliJ IDEA and navigate to Settings/Preferences either using the Configure button from the start screen or the IntelliJ IDEA menu.
- In the Settings/Preferences window, expand the Languages & Frameworks item, select XQuery and choose which default file extensions ans which XQuery flavor you would like to use.
- Click Apply to store your XQuery settings.
Configuring The Processor
You can set up the plugin as a standalone processor or client.
Standalone
- In the Settings/Preferences window, expand the Languages & Frameworks item and select XQuery Data Sources.
- Click on the
+
button in the middle column, to add a new data source. - Select BaseX (native embedded) from the dropdown box.
- In the right-hand column, check the User defined XQJ Driver check box.
- Use the
+
button below the check box to add the followingjars
from your BaseX distribution:basex/BaseX.jar
basex/lib/basex-apj-9.1.1.jar
basex/lib/basex-xqj-9.0.jar
basex/lib/xqj2-0.2.0.jar
- Click Apply to store your settings.
Client
This assumes that you already have a BaseX database named factbook
.
- In the Settings/Preferences window, expand the Languages & Frameworks item and select XQuery Data Sources.
- Click on the
+
button in the middle column, to add a new data source. - Select BaseX from the dropdown box.
- In the right-hand column, fill in the appropriate connection details; e.g. default values:
Host = localhost
Port = 1984
Database name = factbook
Username = admin
Password = admin
- Select Apply, then OK and your BaseX
factbook
database is ready to query.