Managing Custom-Code-Solutions
Within a Custom-Code-Solution there is no possibility of modeling. Once you have implemented the solution, it is possible to export it in the local marketplace. In order to get started with the implementation you have to make sure that the prerequisites are met and then proceed with the following steps.
Prerequisites
Java SDK
A Java 8 SDK is needed to develop custom implementation Java based solutions.
Please download either the Oracle 8 JDK from https://www.oracle.com/technetwork/java/javaee/downloads/index.html or the Open JDK from https://openjdk.java.net/ and follow the installation instructions of the JDK.
Maven
Maven version >=3.6.1 is required to develop custom implementation Java based solutions.
Please download and install maven from https://maven.apache.org
Eclipse
You can develop custom implementation Java based solutions in the IDE of your choice.
We recommend using Eclipse in the latest version which can be downloaded from: https://www.eclipse.org/downloads/
Eclipse Plug-ins
We recommend installing the following Eclipse plug-ins and utilities
- Lombok (https://projectlombok.org/setup/eclipse)
- Editorconfig (https://marketplace.eclipse.org/content/editorconfig-eclipse)
Download Dependencies for Development of Java Solutions
In order to build and run custom Java solutions, some Solution Envoy dependencies are required that come with many already configured tools
Open the Solution Envoy dashboard (e.g. http://myproject.apps.openshift.mycluster.cloud). Navigate to the Infrastructure tab, click and download all the dependencies listed under Maven Dependencies
Install dependencies
The downloaded dependencies must be installed in the local maven repository. Here is
an example how the dependencies can be installed via maven
.
mvn install:install-file -Dfile=cp-framework-sdk-autoconfiguration-1.0.103966.jar -DpomFile=cp-framework-sdk-autoconfiguration-1.0.103966.pom
mvn install:install-file -Dfile=cp-framework-sdk-parent-1.0.103966.pom -DpomFile=cp-framework-sdk-parent-1.0.103966.pom
Running/Building Custom Java Solutions Using the Dependencies
Create custom implementation solution
Open Solution Designer and create new solution via clicking on the Create button. Fill out the
solution specific details but from Type
drop-down make sure to
select Custom Implementation Solution and set Implementation Language
to Java.
Clone Git project to the system
In order to build and run the solution, the Git project should be cloned to the user's workspace. In order to checkout a Custom-Code-Solution open the solution after creation and navigate to the Git tab and copy the Git Source Repository URI.
Alter the URL and add the Git user so it looks like the following:
Before:
https://auto-devops-url/managed-solutions/SOLJAVA.git
After:
https://git@auto-devops-url/managed-solutions/SOLJAVA.git
Open a terminal and clone the solution. You will be prompted for a password. Please use your personal access token as password:
git clone https://git@auto-devops-url/managed-solutions/SOLJAVA.git
Unit tests for custom solutions
It's highly recommended to write unit tests for your Java solutions. The unit tests will be executed during the solution pipeline execution as part of the maven build.