Difference between revisions of "Developing with Eclipse"

From BaseX Documentation
Jump to navigation Jump to search
 
(57 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
This page is part of the [[Developer Section]]. It describes how to get the BaseX sources compiled and running on your system.
 +
 +
Another article in the documentation describes how to use BaseX as a [[Integrating Eclipse|query processor in Eclipse]].
 +
 
==Prerequisites==
 
==Prerequisites==
 
   
 
   
* BaseX is being developed with the [http://www.eclipse.org Eclipse] environment. Other IDEs are used as well in our community, but are not supported by our team.
+
BaseX is developed with the Eclipse environment (other IDEs like IntelliJ IDEA can be used as well). The [https://www.eclipse.org/downloads/ Eclipse IDE for Java Developers] includes the EGit plugin (for [[Git]]) and the m2e plugin (for [[Maven]]).
* The [http://www.eclipse.org/egit/ EGit] plugin is needed to check out the latest sources from our repository within Eclipse.
+
 
* For additional comfort and to work with packages other than the main project, the [http://m2eclipse.sonatype.org m2eclipse] plugin is required, which adds [[Maven]] support to Eclipse.
+
Other Eclipse plugins we use are:
* Additional coding guidelines are defined via Checkstyle and can be integrated with the [http://eclipse-cs.sourceforge.net eclipse-cs] plugin.
+
 
 +
{| class="wikitable"
 +
|- valign="top"
 +
! Name
 +
! Description
 +
! Update URL
 +
! Eclipse Marketplace
 +
|-
 +
| [http://eclipse-cs.sourceforge.net eclipse-cs]
 +
| Enforces Checkstyle coding standards.
 +
| <code><nowiki>http://eclipse-cs.sf.net/update/</nowiki></code>
 +
| [https://marketplace.eclipse.org/marketplace-client-intro?mpc_install=150 install]
 +
|-
 +
| [https://spotbugs.github.io/ SpotBugs]
 +
| Analyze project at byte code level
 +
| <code><nowiki>https://spotbugs.github.io/eclipse/</nowiki></code>
 +
| [https://marketplace.eclipse.org/marketplace-client-intro?mpc_install=3519199 install]
 +
|-
 +
| [http://www.ucdetector.org/ UCDetector]
 +
| Unnecessary code detector
 +
| <code><nowiki>http://ucdetector.sourceforge.net/update</nowiki></code>
 +
| [https://marketplace.eclipse.org/marketplace-client-intro?mpc_install=661 install]
 +
|}
  
 
==Check Out==
 
==Check Out==
 
   
 
   
To check out BaseX and its sub projects, proceed as follows:
+
Our [[Git|Git Tutorial]] explains how BaseX can be checked out from the [https://github.com/BaseXdb/basex GitHub Repository] and embedded in Eclipse with EGit. The article also demonstrates how git can be used on command-line.
+
 
# Choose the project you like:<br/>
+
The basex repository contains the following sub-directories:
## [https://github.com/BaseXdb/BaseX BaseX at GitHub] is the main project
+
# {{Code|basex-core}} is the main project
## [https://github.com/BaseXdb/basex-api BaseX API at GitHub] contains the BaseX APIs (JAX-RX, XQJ, XMLDB, and bindings in other languages)  
+
# {{Code|basex-api}} contains the BaseX APIs (XML:DB, bindings in other languages) and HTTP Services ([[REST]], [[RESTXQ]], [[WebDAV]])  
## [https://svn.uni-konstanz.de/dbis/basex/trunk/examples examples] demonstrates some use cases for BaseX
+
# {{Code|basex-examples}} includes some examples code for BaseX
## [https://svn.uni-konstanz.de/dbis/basex/trunk/jax-rx jax-rx] represents the JAX-RX Interface
+
# {{Code|basex-tests}} contains several unit and stress tests
# Click on ''Finish''
+
 
 +
If the "Problems" View contains errors or warnings, you may need to switch to Java 7 (''Windows'' → ''Preferences'' → ''Installed JREs''). With the Maven plugin from Eclipse, it sometimes requires several attempts to get all dependencies updated. This loop can be avoided if the sources are precompiled via [[Maven]] on command-line.
  
==Start==
+
==Start in Eclipse==
#Press ''Run'' → ''Run&#8230;''
+
# Press ''Run'' → ''Run&#8230;''
#Create a new "Java Application" launch configuration  
+
# Create a new "Java Application" launch configuration  
#Select "basex" as "Project"  
+
# Select "basex" as "Project"  
#Choose a "Main class" (e.g., <code>org.basex.BaseXGUI</code> for the graphical user interface)  
+
# Choose a "Main class" (e.g., <code>org.basex.BaseXGUI</code> for the graphical user interface)  
#Launch the project via ''Run''
+
# Launch the project via ''Run''
  
==Using Maven==
+
==Alternative==
 
If the standalone version of [http://maven.apache.org Maven] is installed,
 
you can run<code> mvn compile </code>in the project directory to compile BaseX.
 
  
Should you wish to create / package your own jars you can do so by running <code>mvn package</code>.
+
You may as well use the standalone version of [[Maven]] to compile and run the project, use other IDEs such as [https://www.jetbrains.com/idea/ IntelliJ IDEA].
By adding the flag <code>-DskipTests=true</code> you can skip running the JUnit-tests.
 
 
Type in<code> java -cp target/classes/org.basex.BaseX </code>to run BaseX.
 
 
You can launch the following classes, which are all placed in the
 
<code>org.basex</code> main package:
 
  
;[[Startup_Options#BaseX_Standalone|BaseX]]
 
: standalone mode
 
;[[Startup_Options#BaseX_Server|BaseXServer]]
 
: server instance, waiting for requests
 
;[[Startup_Options#BaseX_Client|BaseXClient]]
 
: client instance, interacting with the server
 
;[[Startup_Options#BaseX_GUI|BaseXGUI]]
 
:graphical user interface
 
 
Moreover, try <code>-h</code> to have a look at the available command-line options.
 
For example, you can evaluate XQuery expressions or process database commands without
 
entering the console.
 
  
 
[[Category:Developer]]
 
[[Category:Developer]]

Latest revision as of 13:38, 2 July 2020

This page is part of the Developer Section. It describes how to get the BaseX sources compiled and running on your system.

Another article in the documentation describes how to use BaseX as a query processor in Eclipse.

Prerequisites[edit]

BaseX is developed with the Eclipse environment (other IDEs like IntelliJ IDEA can be used as well). The Eclipse IDE for Java Developers includes the EGit plugin (for Git) and the m2e plugin (for Maven).

Other Eclipse plugins we use are:

Name Description Update URL Eclipse Marketplace
eclipse-cs Enforces Checkstyle coding standards. http://eclipse-cs.sf.net/update/ install
SpotBugs Analyze project at byte code level https://spotbugs.github.io/eclipse/ install
UCDetector Unnecessary code detector http://ucdetector.sourceforge.net/update install

Check Out[edit]

Our Git Tutorial explains how BaseX can be checked out from the GitHub Repository and embedded in Eclipse with EGit. The article also demonstrates how git can be used on command-line.

The basex repository contains the following sub-directories:

  1. basex-core is the main project
  2. basex-api contains the BaseX APIs (XML:DB, bindings in other languages) and HTTP Services (REST, RESTXQ, WebDAV)
  3. basex-examples includes some examples code for BaseX
  4. basex-tests contains several unit and stress tests

If the "Problems" View contains errors or warnings, you may need to switch to Java 7 (WindowsPreferencesInstalled JREs). With the Maven plugin from Eclipse, it sometimes requires several attempts to get all dependencies updated. This loop can be avoided if the sources are precompiled via Maven on command-line.

Start in Eclipse[edit]

  1. Press RunRun…
  2. Create a new "Java Application" launch configuration
  3. Select "basex" as "Project"
  4. Choose a "Main class" (e.g., org.basex.BaseXGUI for the graphical user interface)
  5. Launch the project via Run

Alternative[edit]

You may as well use the standalone version of Maven to compile and run the project, use other IDEs such as IntelliJ IDEA.