BaSyx / Download / Java Setup
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.
The BaSyx Java SDK requires the following dependencies to successfully build:
- Java™ SE Development Kit 8, Update 152 (JDK 8u152 or higher)
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.
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 navigate to the directory where BaSyx was checked out to.
Now select (at least) the following Projects:
and click "Finish".
Alternatively, if your Eclipse IDE has EGit and the Maven SCM Handler for EGit installed, you can check out BaSyx directly with Eclipse:
- open File -> Import, and choose "Check out Maven Projects from SCM"
- In the Window that pops up, select "git" in the top left, enter the URL of the BaSyx repository (https://git.eclipse.org/r/basyx/basyx) to the right, and click "Finish".
If you can't select "git" in the upper left, you don't have the Maven SCM Handler for EGit installed. In this case click on the link to the m2e Marketplace in the lower right and install it. If you have issues with installing, you might need to use another update site (| see this bug report).
- In the next window, select the same projects as mentioned above and click "Finish".
Now the three projects will be checked out. However, none of them will compile (regardless of which check-out method you choose) as we have to do some fixes in the next step:
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.
After doing this for each project, do a maven refresh (right-click on project, and choose Maven -> Update Project) for each project.
Now basys.sdk compiles, but the other two projects won't before finishing the next steps:
In order to start developing on the project, the first thing you need to do is
- Make sure that each project has a JDK selected as JRE System Library
- 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. After a successful installation, basys.components does compile now as well.
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” in the "Goals" field and click "Run".
!! Note: Make sure to clean compile after each install! Otherwise, your changes in the code will not be reflected in manual unit testing. !!
To make basyx.examples compile, you need to do a Maven install of basys.components first. This, in turn, requires to set up and run your postgreSQL installation as described here.