Integrating IntelliJ IDEA

From BaseX Documentation

(Difference between revisions)
Jump to: navigation, search
Line 21: Line 21:
[[File:intellij-startbildschirm.png]]
[[File:intellij-startbildschirm.png]]
-
# Start IntelliJ IDEA and select ''Configure''→''Plugins''.
+
* Start IntelliJ IDEA and select ''Configure''→''Plugins''.
-
# In the Plugins window select the tab ''Marketplace''.
+
* In the Plugins window select the tab ''Marketplace''.
-
# Type "XQuery Support" into the ''Search plugins in marketplace'' field.
+
* Type "XQuery Support" into the ''Search plugins in marketplace'' field.
-
# Click the ''Install'' button below the ''XQuery Support + MarkLogic Debugger'' plugin.
+
* Click the ''Install'' button below the ''XQuery Support + MarkLogic Debugger'' plugin.
-
# You will be prompted to restart IDEA to load the new plugin.
+
* You will be prompted to restart IDEA to load the new plugin.
===From the IntelliJ IDEA Menu===
===From the IntelliJ IDEA Menu===
-
# Select ''Settings/Preferences'' in the ''IntelliJ IDEA'' menu.
+
* Select ''Settings/Preferences'' in the ''IntelliJ IDEA'' menu.
-
# In the Settings/Preferences window select ''Plugins''.
+
* In the Settings/Preferences window select ''Plugins''.
-
# In the Plugins window select the tab ''Marketplace''.
+
* In the Plugins window select the tab ''Marketplace''.
-
# Type "XQuery Support" into the ''Search plugins in marketplace'' field.
+
* Type "XQuery Support" into the ''Search plugins in marketplace'' field.
-
# Click the ''Install'' button below the ''XQuery Support + MarkLogic Debugger'' plugin.
+
* Click the ''Install'' button below the ''XQuery Support + MarkLogic Debugger'' plugin.
-
# You will be prompted to restart IDEA to load the new plugin.
+
* You will be prompted to restart IDEA to load the new plugin.
==Setting Up==
==Setting Up==
Line 48: Line 48:
===Standalone===
===Standalone===
-
# In the Settings/Preferences window, expand the ''Languages & Frameworks'' item and select ''XQuery Data Sources''.
+
* In the Settings/Preferences window, expand the ''Languages & Frameworks'' item and select ''XQuery Data Sources''.
-
# Click on the {{Code|+}} button in the middle column, to add a new data source.
+
* Click on the {{Code|+}} button in the middle column, to add a new data source.
-
# Select ''BaseX (native embedded)'' from the dropdown box.
+
* Select ''BaseX (native embedded)'' from the dropdown box.
-
# In the right-hand column, check the ''User defined XQJ Driver'' check box.
+
* In the right-hand column, check the ''User defined XQJ Driver'' check box.
-
# Use the  {{Code|+}} button below the check box to add the following {{code|jars}} from your BaseX distribution:
+
* Use the  {{Code|+}} button below the check box to add the following {{code|jars}} from your BaseX distribution:
-
#* {{Code|basex/BaseX.jar}}
+
** {{Code|basex/BaseX.jar}}
-
#* {{Code|basex/lib/basex-apj-9.1.1.jar}}
+
** {{Code|basex/lib/basex-apj-9.1.1.jar}}
-
#* {{Code|basex/lib/basex-xqj-9.0.jar}}
+
** {{Code|basex/lib/basex-xqj-9.0.jar}}
-
#* {{Code|basex/lib/xqj2-0.2.0.jar}}
+
** {{Code|basex/lib/xqj2-0.2.0.jar}}
-
# Click ''Apply'' to store your settings.
+
* Click ''Apply'' to store your settings.
===Client===
===Client===
This assumes that you already have a BaseX database named {{code|factbook}}.
This assumes that you already have a BaseX database named {{code|factbook}}.
-
# In the Settings/Preferences window, expand the ''Languages & Frameworks'' item and select ''XQuery Data Sources''.
+
* In the Settings/Preferences window, expand the ''Languages & Frameworks'' item and select ''XQuery Data Sources''.
-
# Click on the {{Code|+}} button in the middle column, to add a new data source.
+
* Click on the {{Code|+}} button in the middle column, to add a new data source.
-
# Select ''BaseX'' from the dropdown box.
+
* Select ''BaseX'' from the dropdown box.
-
# In the right-hand column, fill in the appropriate connection details; e.g. default values:
+
* In the right-hand column, fill in the appropriate connection details; e.g. default values:
-
#* <code>Host = localhost</code>
+
** <code>Host = localhost</code>
-
#* <code>Port = 1984</code>
+
** <code>Port = 1984</code>
-
#* <code>Database name = factbook</code>
+
** <code>Database name = factbook</code>
-
#* <code>Username = admin</code>
+
** <code>Username = admin</code>
-
#* <code>Password = admin</code>
+
** <code>Password = admin</code>
-
# Select ''Apply'', then ''OK'' and your BaseX {{code|factbook}} database is ready to query.
+
* Select ''Apply'', then ''OK'' and your BaseX {{code|factbook}} database is ready to query.
[[File:Intellij-basex-data-source.png]]
[[File:Intellij-basex-data-source.png]]
==Querying Your Data==
==Querying Your Data==
-
# To create a new project, choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
+
* To create a new project, choose the ''Create new project'' option from the start screen or select ''New''→''Project...'' from the ''File'' menu.
-
# In the ''New Project'' dialog choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
+
* In the ''New Project'' dialog choose ''Empty Project'' from the left-hand column and click the ''Next'' button.
-
# Enter a name and location for your project.
+
* Enter a name and location for your project.
-
# Click ''Finish'' to create the project.
+
* In the project view, create a new XQuery file, either by right-clicking on the project name and choosing ''New''→''XQuery File'' or by selecting ''New''→''XQuery File'' from the File menu.
 +
* Type in your query.
 +
* Click the green ''Run'' button below the IntelliJ IDEA menu bar.
 +
* In the ''Edit Configuration'' dialog choose one of the two data source from the dropdown box, either "BaseX" or "BaseX (native embedded)". If you select "BaseX", make sure that BaseX is up and running.
 +
* Click ''Run'' to execute your query.

Revision as of 12:35, 24 January 2019

This article is part of the Getting Started Section. It describes how to run XPath/XQuery code from within the IntelliJ IDEA IDE.

Contents

Preparations

The following steps apply to all operating systems:

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

Intellij-startbildschirm.png

From the IntelliJ IDEA Menu

Setting Up

File Extensions and XQuery Flavor

Intellij-xquery-settings.png

Configuring The Processor

You can set up the plugin as a standalone processor or client.

Standalone

Client

This assumes that you already have a BaseX database named factbook.

Intellij-basex-data-source.png

Querying Your Data

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export