Upgrading from 4.0.5 to 4.1.0
How to upgrade
Please notice that upgrading to version 4.1.0 is only possible from version 4.0.5, please check Upgrading from 4.0.x to 4.0.5 if you need to upgrade from a previous version.
Supported Node.js version
From version 4.1.0, IBM Industry Solutions Workbench only supports Node.js version 18.16.0 and higher. All newly created TypeScript and JavaScript projects will require Node.js 18.16.0 as a minimum version. Also the Solution CLI requires Node.js 18.16.x to be installed on your system for local development.
Upgrade to Node.js 18.16.x
Download Node.js 18.16.x and install it on your local system using your preferred tooling.
Helping links:
Upgrade your locally installed Solution CLI to the latest version by running
k5 upgrade-cli
Update your TypeScript or JavaScript projects to require Node.js 18.16.x
There is no necessity of upgrading your already existing service projects to the new Node.js version. If you would like to stay on Node.js 16, you can leave everything as is. However, it is recommended to upgrade all your service projects
To upgrade your service projects, please execute the following steps:
- Clone your service project locally and open it in your IDE of choice
- Open the file
package.json
- Adjust dev-dependency
@types/node
to a value greater than18.16.0
"devDependencies": { ... "@types/node": "^18.16.19", ... }
- Ensure that property
engines.node
is set to value>=18.16.0
"engines": { "node": ">=18.16.0" },
- Run command
npm install
to update your localpackage-lock.json
Generic Service Java (formally known as pro-code Java project)
Adjust your Generic Service Java projects created with previous versions
Dependency update
Generic Service Java projects use several functionalities provided by the dependency "cp-framework-sdk", which has been updated to include new fixes, and versions of underlying used dependencies.
All existing Generic Service Java projects have to download this new version and migrate to this new version.
Migration steps
Open the Solution Envoy dashboard (you can find the link in Solution Designer on the CI/CD page after you have set up at least one deploy pipeline or inside Solution Hub after selecting a k5-project and opening the tab "Service Deployments")
Navigate to the Infrastructure page and download all the dependencies listed under Maven Dependencies (Java)
Install dependencies in the local maven repository. Below is an example how the dependencies can be installed via maven
mvn install:install-file -Dfile=cp-framework-sdk-autoconfiguration-4.0.247.jar -DpomFile=cp-framework-sdk-autoconfiguration-4.0.247.pom mvn install:install-file -Dfile=cp-framework-sdk-parent-4.0.247.pom -DpomFile=cp-framework-sdk-parent-4.0.247.pom
Clone / Open your service project
Navigate to pom.xml file
Search for the parent attribute and change it to match the new "cp-framework-sdk" version, see the following snippet example:
<parent> <groupId>de.knowis.cp.sdk</groupId> <artifactId>cp-framework-sdk-parent</artifactId> <version>4.0.247</version> <relativePath> ./.framework/repo/de/knowis/cp/sdk/cp-framework-sdk-parent/4.0.247/cp-framework-sdk-parent-4.0.247.pom </relativePath> </parent>
NOTE Current latest version of "cp-framework-sdk" that is shipped with the IBM Industry Solutions Workbench 4.1 is 4.0.247.
Push your adjustment and run your pipeline(s) to make sure your projects deploy successfully
Swagger configuration adjustment
With version 4.1.0 of IBM Industry Solutions Workbench the accessibility of Swagger has changed. In order to use it for existing Java projects, the configuration has to be migrated.
Migration steps
- Open your Java solution
- Navigate to the path /src/main/java/ACRONYM/config/SwaggerConfiguration.java
- Replace the configuration with the following sample
- Commit and push your changes
- Re-execute the pipelines of your project in solution designer
import org.springdoc.core.customizers.OpenApiCustomiser; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import de.knowis.cp.common.environment.featureflag.condition.ConditionalOnFeatureFlag; import de.knowis.cp.common.openapi.security.SecurityCustomizer; import de.knowis.cp.common.openapi.ui.EnableOpenApiUi; import de.knowis.cp.common.security.autoconfiguration.OidcConfiguration; import de.knowis.cp.common.solution.autoconfiguration.SolutionConfigurationProperties; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.servers.Server; @EnableOpenApiUi @Configuration @ConditionalOnFeatureFlag("feature.openapi.enabled") public class SwaggerConfiguration { private final SolutionConfigurationProperties solutionConfiguration; private final OidcConfiguration oidcConfig; @Value("${de.knowis.cp.server.baseurl}") private String baseUrl; public SwaggerConfiguration(SolutionConfigurationProperties solutionConfiguration, OidcConfiguration oidcConfig) { this.solutionConfiguration = solutionConfiguration; this.oidcConfig = oidcConfig; } private static final String ACRONYM_GROUP_DESC = ""; private static final String ACRONYM_GROUP_VERSION = "1.0.0"; @Bean public OpenApiCustomiser securityCustomizer() { return new SecurityCustomizer(oidcConfig::getUserTokenUrl); } @Bean public OpenApiCustomiser serversCustomizer() { return openApi -> { openApi.getServers().clear(); openApi.addServersItem(new Server().url(baseUrl)); }; } @Bean public OpenApiCustomiser infoCustomizer() { return openApi -> openApi.info(new Info().title(solutionConfiguration.getAcronym()) .description(ACRONYM_GROUP_DESC).version(ACRONYM_GROUP_VERSION)); } }
Domain Service Java (formally known as low-code Java project)
Adjust your Domain Service Java projects created with previous versions
Dependency Update
Domain Service Java projects use several functionalities provided by the dependency "cp-framework-sdk", which has been updated to include new fixes, and versions of underlying used dependencies.
All existing Domain Service Java projects are required to migrate to this new version.
Clone (
k5 clone
) or update (k5 pull
) your service projectOpen your service project
Navigate to pom.xml file
Search for the parent attribute and change it to match the new "cp-framework-sdk" version, see the following snippet example:
<parent> <groupId>de.knowis.cp.sdk</groupId> <artifactId>cp-framework-managed-sdk-parent</artifactId> <version>4.0.247</version> <relativePath> ./.framework/repo/de/knowis/cp/sdk/cp-framework-managed-sdk-parent/4.0.247/cp-framework-managed-sdk-parent-4.0.247.pom </relativePath> </parent>
NOTE Current latest version of "cp-framework-sdk" that is shipped with the IBM Industry Solutions Workbench 4.1 is 4.0.247.
Push your adjustment and run your pipeline(s) to make sure your projects deploy successfully
Changed method signature for API operations
Since IBM Industry Solutions Workbench 4.1.0, some method signatures of API Operations changed, as the order of the parameters during generation was adjusted.
Only API operations, which use required header parameters, are affected.
Before 4.1.0, required header parameters were not sorted before the not-required parameters in the generated method signature of API operations (unlike required query or path parameters). With 4.1.0 this bug got fixed and therefore the signature of some API operations will now changed. Please find below an example of how the signatures used to look and how they look since 4.1.0
Before:
@Override
public ResponseEntity<Void> myOperation(String reqPathParam, String reqQueryParam, MyRequestBody reqRequestBody, String someQueryParam, String reqHeaderParam, String, someHeaderParam) {
...
}
After:
@Override
public ResponseEntity<Void> myOperation(String reqPathParam, String reqQueryParam, String reqHeaderParam, MyRequestBody reqRequestBody, String someQueryParam, String, someHeaderParam) {
...
}
There are 2 options to handle this change:
- Option 1: Change your implemenation code
- The easiest and safest way is to let the system re-generate the signature of your API method
- Clone the project to your local machine
- Open your APIProvider-Class
- Comment out the API operation methods, so that your IDE will complain, that not all methods are implemented
- Add all unimplemented methods (this way you get the new method signature)
- Move your implementation code from your the commented methods to the new methods
- Run
k5 compile
to ensure your code is working and runk5 push
to push your changes to the remote git afterwards
- Option 2: Change your header parameters to be not required
- If you don't want to adapt the code of your project, you could also change your required header parameters to be not required anylonger
- After commiting and pushing the change through the Solution Designer, the project should compile again and no adaption in the code is necessary
Please keep in mind that it is only guaranteed, that the required parameters are before the not-required ones. The remaining order is dependent on the position of the parameters within your API specification.
Using Date and Datetime in event payloads
Since IBM Industry Solutions Workbench 4.1.0, it is possible to use Date and Datetime properties within schemas that are used as event payloads (see related resolved issue Using the date type for sending events is blocked by the sender due to wrong validation). To allow this, existing projects have to be adjusted to have special settings defined.
This change only has to be done, if you want to use Date and Datetime properties natively within your events.
Please execute the following steps:
Open your pom.xml file of your application and find the plugin
jsonschema2pojo-maven-plugin
Add some additional configuration regarding formatting of Date and Datetime to the plugin
<formatDates>true</formatDates> <formatDateTimes>true</formatDateTimes> <dateType>java.util.Date</dateType> <dateTimeType>java.time.OffsetDateTime</dateTimeType>
After adjusting, the plugin should look similar to this:
<plugin> <groupId>org.jsonschema2pojo</groupId> <artifactId>jsonschema2pojo-maven-plugin</artifactId> <version>1.1.2</version> <configuration> <sourceDirectory>${basedir}/src/main/generated-resources/schemas</sourceDirectory> <targetPackage>yourPackageName.yourProjectAcronym.sdk.domain.schemas</targetPackage> <outputDirectory>${basedir}/src/main/generated</outputDirectory> <formatDates>true</formatDates> <formatDateTimes>true</formatDateTimes> <dateType>java.util.Date</dateType> <dateTimeType>java.time.OffsetDateTime</dateTimeType> </configuration> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>
Run command
k5 generate-code
again to re-trigger code generationAdjust your implementation code wherever needed.
Example:
@Override public ResponseEntity<Void> publish() { // create new instance of event MyEventWithDateProperty ev = pubEventBuilder.getMyEventWithDateProperty().build(); MySchema payload = new MySchema(); // set date property payload.setDate(new Date()); // publish event eventProducer.publish(ev); // further code ... }
To be consistent, please adjust both event producer and event consumer projects
Upgrade your project to Java Spring Boot Stack 2.0
If your Java project was created before IBM Industry Solutions Workbench 4.1.0, the project is based on Java Spring Boot Stack 1.0 which comes with Java Spring Boot 2 and Java 11. From IBM Industry Solutions Workbench 4.1.0 all projects that are created from scratch will by default use Java Spring Boot Stack 2.0 as a base which comes with Java Spring Boot 2 and Java 11.
To migrate your existing projects from Java Spring Boot Stack 1.0 to Java Spring Boot Stack 2.0 please check the following Upgrade Instructions
K5 cli fix for global git configs
From version 4.1.0, K5 cli will no longer set the global http.sslVerify
git config to false
. If required, you can set the global http.sslVerify
manually by running the following command:
git config --global http.sslVerify true