DEV Community

Pawel Wolanski
Pawel Wolanski

Posted on

SAP Commerce Cloud Framework Update JDK 21 - issue with ANT gradle target

Recently I have been involved in Framework Update engagement to bump Commerce Cloud solution from JDK 17 to JDK 21.

Upgrade to Java 21 It has been announced some time ago by SAP as a Framework Update
which bumps Java, Spring and long list of dependencies to latest Java LTS.
More information about service you can find on:

One of nice things which has been added by SAP is upgrade automation based on OpenRewrite. More information about whole activity you can find as SAP KBA 3618495 - Using OpenRewrite recipes to support SAP Commerce Cloud JDK21 Framework Update adoption

Issue

At the beginning when you run ant command ant gradle you may get similar error like:

/opt/hybris/hybris/bin/platform/build.xml:204: Cannot invoke "String.startsWith(String)" because the return value of "org.apache.maven.model.Dependency.getVersion()" is null
Enter fullscreen mode Exit fullscreen mode

That error is related to scanning process for Maven dependencies in external-dependencies.xml.

Root cause

In my case one of external-dependencies.xml for custom extension got dependency defined:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>de.hybris.platform</groupId>
    <artifactId>knackbravaocc</artifactId>
    <version>2211.1</version>
    <packaging>jar</packaging>

    <dependencies>
...
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
...
    </dependencies>
</project>
Enter fullscreen mode Exit fullscreen mode

In order to fix it, I needed to add version explicitly for that dependency.

Solution

Check if your all dependencies have version xml tag defined.

Top comments (0)