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 a section about how to configure Eclipse IDE for BaSyx (or generic hierarchical Maven projects))
Line 44: Line 44:
  
 
After installation build outputs are placed in the /target folder and installed in the local Maven repository.  
 
After installation build outputs are placed in the /target folder and installed in the local Maven repository.  
 
=== Further steps ===
 
 
The '''[[BaSyx_/_Examples | basyx.examples]]''' project is a good starting point that shows how the SDK can be included and used by another project.
 
Also look at '''[[BaSyx_/_Download_/_Components_Setup|basyx.components]]''' to get a description about how to set up and use components that are built on the '''basyx.sdk'''. There is also an article about how to '''[[BaSyx_/_Developer_/_Contributing | contribute]]''' to the open source code.
 
  
 
===Eclipse IDE configuration===
 
===Eclipse IDE configuration===
Although the Eclipse IDE can handle the BaSyx projects, there are multiple settings that will make it easier to work with them. This is especially true, if you are working with hierarchical Maven projects as with basyx.components.
+
Although the Eclipse IDE can handle the BaSyx projects, there are multiple settings that will make it easier to work with them. This is especially true, if you are working on hierarchical Maven projects as with basyx.components.
  
 
* Enable a '''hierarchical Maven projects''' representation
 
* Enable a '''hierarchical Maven projects''' representation
Line 82: Line 77:
  
 
[[File:BaSyxEclipseIDE.jpg]]
 
[[File:BaSyxEclipseIDE.jpg]]
 +
 +
=== Further steps ===
 +
 +
The '''[[BaSyx_/_Examples | basyx.examples]]''' project is a good starting point that shows how the SDK can be included and used by another project.
 +
Also look at '''[[BaSyx_/_Download_/_Components_Setup|basyx.components]]''' to get a description about how to set up and use components that are built on the '''basyx.sdk'''. There is also an article about how to '''[[BaSyx_/_Developer_/_Contributing | contribute]]''' to the open source code.

Revision as of 05:53, 10 March 2020

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 set up the Java SDK from a new 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. No Eclipse GIT plugin is required as we can do the checkout by using GIT only from the command line. If you want to checkout using Eclipse, you need the EGit plugin and also the Maven SCM Handler for EGit (more on that below).

Getting started

  1. Check out BaSyx from the command line with "git clone https://git.eclipse.org/r/basyx/basyx"
  2. Start Eclipse and import the projects as maven projects (File -> Import -> Maven -> Existing Maven Projects -> Browse to the BaSyx directory)
  3. Select (at least) the following Projects and click "Finish":

Project-selection.png

The Maven projects should be automatically set up in Eclipse. You can always update the project settings using the Maven plugin (Right Click -> Maven -> Update Project).

Project dependencies

All dependencies for maven projects are specified in the project's pom.xml. When building the project using maven, these dependencies will be automatically taken from the local maven repository (default: C:/User/username/.m2/repository) and downloaded from the remote repository if it is not available locally.

The imported projects (sdk, components and examples) depend on each other as shown below:

BaSyx Java Dependencies.PNG

This means basyx.components depends on basyx.sdk and basyx.examples depends on the two other projects. So if you make changes in e.g. basyx.sdk, you need to "install" it to the local repository using Maven before building components that depend on it.

Project installation

  1. Make sure that each project has a JDK selected as JRE System Library
    1. Window -> Preferences -> Java -> Installed JREs -> Enable the JDK
    2. -> Execution Environments -> JavaSE-1.8 -> Enable the JDK in the list of compatible JREs
  2. Install basyx.sdk
    1. Right click -> Run As -> Maven install
    2. Maven will download all required dependencies, run the tests and build and install the project into the local Maven repository
    3. You can ignore errors in the output coming from testing exceptions in unit tests
    4. If successful, you will see the message: [INFO] BUILD SUCCESS
  3. Prepare the components as described in Setting up the Components project
  4. Install basyx.components and basyx.examples
  5. Done

After installation build outputs are placed in the /target folder and installed in the local Maven repository.

Eclipse IDE configuration

Although the Eclipse IDE can handle the BaSyx projects, there are multiple settings that will make it easier to work with them. This is especially true, if you are working on hierarchical Maven projects as with basyx.components.

  • Enable a hierarchical Maven projects representation
    • Window -> Show View -> Project Explorer
    • Project Explorer View Menu (three dots in the top right corner of the view) -> Projects Presentation -> Hierarchical
  • Enable a hierarchical packages representation
    • Project/Package Explorer View Menu -> Package Presentation -> Hierarchical
  • Make use of working sets to organize multiple groups of projects
    • Project/Package Explorer View Menu -> Top Level Elements -> Working Sets
    • Project Explorer View Menu -> Select Working Set -> New...
    • Add a Java working set named e.g. "BaSyx" and add all basyx.* projects to it
    • Add another Java working set for e.g. your own projects
  • Prepare useful launch configurations
    • Right Click basyx.sdk project -> Run As -> Maven build..
    • Rename the launch configuration to e.g. "Install BaSyx SDK"
    • Enter "clean install" in "Goals:"
    • Click Apply and close the window
    • Repeat this for other run configurations (e.g. install components/examples...)
    • Click at the small, black down-arrow right next to the "Run As..."-icon (the white arrow in a green circle) in the toolbar
    • Organize Favorites... -> Add... -> Check "Install BaSyx SDK"
    • Click at the arrow next to the "Run As..."-icon again
    • Run your favorite launch configuration
  • Customize resource filters if necessary (if you would like to see e.g. .gitignore or .env files)
    • Project Explorer Filters & Customization (filter symbol in the top right corner of the view)
    • Uncheck .* resources in the list of Pre-set filters to be able to see .* files
    • Add own filters to hide specific files or folders again (e.g. .project, .classpath and .settings)


Final result:

BaSyxEclipseIDE.jpg

Further steps

The basyx.examples project is a good starting point that shows how the SDK can be included and used by another project. Also look at basyx.components to get a description about how to set up and use components that are built on the basyx.sdk. There is also an article about how to contribute to the open source code.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.