Difference between revisions of "Integrating IntelliJ IDEA"

From BaseX Documentation
Jump to navigation Jump to search
Line 1: Line 1:
 
This article is part of the [[Getting Started]] Section. It describes how to run XPath/XQuery code from within the [https://www.jetbrains.com/idea IntelliJ IDEA IDE].
 
This article is part of the [[Getting Started]] Section. It describes how to run XPath/XQuery code from within the [https://www.jetbrains.com/idea IntelliJ IDEA IDE].
  
=Installation=
+
=Preparations=
  
 
The following steps apply to all operating systems:
 
The following steps apply to all operating systems:
  
 
* Install either version of IntelliJ IDEA: [https://www.jetbrains.com/idea/#chooseYourEdition the Community or Ultimate edition].
 
* Install either version of IntelliJ IDEA: [https://www.jetbrains.com/idea/#chooseYourEdition the Community or Ultimate edition].
* Download your favorite BaseX distribution (JAR, ZIP, EXE): http://basex.org/download/.
+
* Download your favorite [http://basex.org/download BaseX distribution] (JAR, ZIP, EXE).
 +
* Start BaseX (see [[Startup]]).
 +
* Create a BaseX database (see [[Databases]]).
  
This article focuses on Grzegorz Ligas' [https://plugins.jetbrains.com/idea/plugin/7262-xquery-support XQuery Support plugin].
+
=XQuery Support + MarkLogic Debugger=
  
After installing IDEA and BaseX, install the XQuery Support plugin by one of the following methods:
+
This section focuses on Grzegorz Ligas' [https://plugins.jetbrains.com/plugin/9757-xquery-support--marklogic-debugger 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===
 
===From the Start Screen===
# Start IDEA and select ''Configure''→''Plugins''.
+
 
# In the Plugins window select ''Browse Repositories''.
+
[[File:intellij-startbildschirm.png]]
# In the Browse Repositories window, search for (or scroll to) ''XQuery Support''.
+
 
 +
# 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.
 
# You will be prompted to restart IDEA to load the new plugin.
  
===From the File Menu===
+
===From the IntelliJ IDEA Menu===
# Select ''Settings''.
+
# Select ''Settings/Preferences'' in the ''IntelliJ IDEA'' menu.
# In the Settings window select ''Plugins''.
+
# In the Settings/Preferences window select ''Plugins''.
# In the Plugins window select ''Browse Repositories''.
+
# In the Plugins window select the tab ''Marketplace''.
# In the Browse Repositories window, search for (or scroll to) ''XQuery Support''.
+
# 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.
 
# You will be prompted to restart IDEA to load the new plugin.
  
Line 27: Line 38:
  
 
==File Extensions and XQuery Flavor==
 
==File Extensions and XQuery Flavor==
* Start IDEA and navigate to ''Settings'' (OS dependent).
+
* 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 window select ''Other Settings''''XQuery'' and choose which XQuery flavor you would like to use, as well as new file extensions. (see attached screenshot)
+
* 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.
 +
 
 +
[[File:intellij-xquery-settings.png]]
  
 
==Configuring The Processor==
 
==Configuring The Processor==
Line 34: Line 48:
  
 
===Standalone===
 
===Standalone===
# Start IDEA and navigate to ''Settings'' (OS dependent).
+
# In the Settings/Preferences window, expand the ''Languages & Frameworks'' item and select ''XQuery Data Sources''.
# In the settings window select ''Other Settings''''XQuery Data Sources''
+
# Click on the {{Code|+}} button in the middle column, to add a new data source.
# Select ''BaseX (native embedded)''.
+
# Select ''BaseX (native embedded)'' from the dropdown box.
# Check the ''User defined XQJ Driver'' radio box.
+
# In the right-hand column, check the ''User defined XQJ Driver'' check box.
# Using the '''+''', add the following {{code|jars}}: BaseX.jar, basex-api-8.6.1.jar, basex-xqj-8.6.jar, and xqj2-0.2.0.jar 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/lib/basex-apj-9.1.1.jar}}
 +
#* {{Code|basex/lib/basex-xqj-9.0.jar}}
 +
#* {{Code|basex/lib/xqj2-0.2.0.jar}}
 +
# Click ''Apply'' to store your settings.
  
 
===Client===
 
===Client===
This assumes that you already have a database named {{code|factbook}}.
+
This assumes that you already have a BaseX database named {{code|factbook}}.
# Start IDEA and navigate to ''Settings'' (OS dependent).
+
# In the Settings/Preferences window, expand the ''Languages & Frameworks'' item and select ''XQuery Data Sources''.
# In the settings window select ''Other Settings''''XQuery Data Sources''
+
# Click on the {{Code|+}} button in the middle column, to add a new data source.
# Using the '''+''', select ''BaseX'' as your data source
+
# Select ''BaseX'' from the dropdown box.
# 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>
Line 52: Line 71:
 
#* <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]]

Revision as of 13:07, 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.

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

  1. Start IntelliJ IDEA and select ConfigurePlugins.
  2. In the Plugins window select the tab Marketplace.
  3. Type "XQuery Support" into the Search plugins in marketplace field.
  4. Click the Install button below the XQuery Support + MarkLogic Debugger plugin.
  5. You will be prompted to restart IDEA to load the new plugin.

From the IntelliJ IDEA Menu

  1. Select Settings/Preferences in the IntelliJ IDEA menu.
  2. In the Settings/Preferences window select Plugins.
  3. In the Plugins window select the tab Marketplace.
  4. Type "XQuery Support" into the Search plugins in marketplace field.
  5. Click the Install button below the XQuery Support + MarkLogic Debugger plugin.
  6. 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.

Intellij-xquery-settings.png

Configuring The Processor

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

Standalone

  1. In the Settings/Preferences window, expand the Languages & Frameworks item and select XQuery Data Sources.
  2. Click on the + button in the middle column, to add a new data source.
  3. Select BaseX (native embedded) from the dropdown box.
  4. In the right-hand column, check the User defined XQJ Driver check box.
  5. Use the + button below the check box to add the following jars 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
  6. Click Apply to store your settings.

Client

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

  1. In the Settings/Preferences window, expand the Languages & Frameworks item and select XQuery Data Sources.
  2. Click on the + button in the middle column, to add a new data source.
  3. Select BaseX from the dropdown box.
  4. 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
  5. Select Apply, then OK and your BaseX factbook database is ready to query.

Intellij-basex-data-source.png