Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "BaSyx / Download / Java Setup"

(Adds JUnit setup)
Line 8: Line 8:
 
* Java™ SE Development Kit 8, Update 152 (JDK 8u152 or higher)
 
* Java™ SE Development Kit 8, Update 152 (JDK 8u152 or higher)
 
* Maven
 
* Maven
 +
 +
To check out BaSyx, you also need a GIT installation. However, no Eclipse GIT plugin is required as we use GIT only from the command line for our purposes.
  
 
== Getting started ==
 
== Getting started ==
The following Eclipse Projects can be imported to Eclipse via Import -> Maven -> Existing Maven Projects:
+
Check out BaSyx from the command line with
 +
 
 +
git clone https://git.eclipse.org/r/basyx/basyx
 +
 
 +
into some directory of your choice. Now start Eclipse, open File -> Import, choose Maven -> Existing Maven Projects, and click "Next". Now click "Browse", and select the directory where BaSyx was checked out to.
 +
 
 +
Now select (at least) the following Projects:
 
* basys.sdk
 
* basys.sdk
 
* basys.components
 
* basys.components
 
* basys.examples
 
* basys.examples
 +
 +
 +
and click "Finish".
  
 
=== Eclipse setup ===
 
=== Eclipse setup ===
Line 20: Line 31:
 
[[File:BaSyx-Setup.PNG]]
 
[[File:BaSyx-Setup.PNG]]
  
After doing this for each project, do a maven refresh for each project.
+
After doing this for each project, do a maven refresh (right-click on project, and choose Maven -> Update Project) for each project.
  
 
Additionally, JUnit has to be set up. To do so, add in the project properties JUnit to the build path by Java Build Path -> Libraries -> Add Library
 
Additionally, JUnit has to be set up. To do so, add in the project properties JUnit to the build path by Java Build Path -> Libraries -> Add Library

Revision as of 11:32, 5 August 2019

How to build the BaSyx Java SDK

The BaSyx Java SDK is using maven to generate and control its building process. This article will detail on how to build the Java SDK from a fresh checkout.

Requirements

The BaSyx Java SDK requires the following dependencies to successfully build:

  • Java™ SE Development Kit 8, Update 152 (JDK 8u152 or higher)
  • Maven

To check out BaSyx, you also need a GIT installation. However, no Eclipse GIT plugin is required as we use GIT only from the command line for our purposes.

Getting started

Check out BaSyx from the command line with

git clone https://git.eclipse.org/r/basyx/basyx

into some directory of your choice. Now start Eclipse, open File -> Import, choose Maven -> Existing Maven Projects, and click "Next". Now click "Browse", and select the directory where BaSyx was checked out to.

Now select (at least) the following Projects:

  • basys.sdk
  • basys.components
  • basys.examples


and click "Finish".

Eclipse setup

Eclipse currently does not correctly import the source folders. To fix this, go to the properties of each project, remove the existing source folder entry src and add src/main/java and src/test/java.

BaSyx-Setup.PNG

After doing this for each project, do a maven refresh (right-click on project, and choose Maven -> Update Project) for each project.

Additionally, JUnit has to be set up. To do so, add in the project properties JUnit to the build path by Java Build Path -> Libraries -> Add Library BaSyx-Setup AddJUnit.PNG


Starting development

In order to start developing on the project, the first thing you need to do is

  1. Make sure that each project has a JDK selected as JRE System Library
  2. Right-click “basys.sdk” >> Select “Run As” >> Select “Maven Install”


Maven will download all required sources, run the unit and integration tests and export a jar of the SDK to the .components and .examples project. The mentioned projects are depending on each other in the following sense: BaSyx Java Dependencies.PNG

That means the basys.sdk project is required as a .jar file in each of the local maven repositories of basys.examples and basys.components. If you want to make changes to the basys.sdk project, you need to make a maven install in order to see the changes reflect in the other projects.

Before you get started, the second task you need to do is to update the .sdk project to align with the maven configuration. For this what you need to do is

  • Right-click “basys.sdk” >> Select “Maven” >> Select “Update Project…” (ignore errors)

Finally, the last step is to run a Maven clean compile to make sure that the changes you do during coding are directly reflected when you execute single unit tests manually.

  • Right-click “basys.sdk” >> Select “Run As” >> Select “Build…” >> Type “clean test-compile” and hit Enter


!! Note: Make sure to clean compile after each install! Otherwise, your changes in the code will not be reflected in manual unit testing. !!

Back to the top