CRM and CX Blogs by Members
Find insights on SAP customer relationship management and customer experience products in blog posts from community members. Post your own perspective today!
cancel
Showing results for 
Search instead for 
Did you mean: 
R_Zieschang
Contributor
SAP Customer Checkout 2.0 FP13 was released recently with a bunch of new features for users and consultants. But also developers will see some changes within the ENV.jar to develop fantastic plugins for the product.

So what did change exactly?

The fat jar is dead


Prior to FP13 the ENV.jar was distributed as a "fat" JAR file, meaning all dependencies SAP Customer Checkout was using, were included in this JAR. This made development pretty easy as you could use these dependencies (e.g. Apaches Commons libraries) right away without worrying about the correct version to use.

You may have recognized the new folder "envLib" in your cco folder?


Furthermore the ENV.jar became much smaller than in previous releases!


ENV.jar FP12



ENV.jar FP13


Looking at these screenshots it may already dawn on you.

YES! The ENV.jar in FP13 does not have the dependencies included. This will lead, if not handled correctly by the developer to some confusions and strange behavior while runtime.

Imaging the situation, you want to use the Apache commons IO package in Version 2.8.1 because you encountered a bug in 2.8.0. You can include this dependency in your plugin via e.g. maven and on compile time everything looks fine.

You load up your CCO FP13 and realize your plugin is still affected by the bug in 2.8.0! Why?

Because CCO FP13 (see screenshot from the envLib folder) still uses 2.8.0 and because CCO will load before your plugin loads, your plugin will show unwanted behavior.

So how can we have the ENV.jar with all dependencies like we used to?

Dependency reduced pom.xml


With the release of FP13 SAP will provide a pom.xml which only holds information about the dependencies.


The dependency-reduced-pom.xml aka ENV.pom



Content of the ENV.pom


With the "thin" ENV.jar and the ENV.pom we can deploy this artifact in our local maven repository. The ENV.pom will include 3 packages, which are not in the public maven repositories, but we can deploy them with the same procedure.

So how do we do that?

Install the artifact


Open the command line tool of your choice. As I use macOs I will use iTerm2, on windows you can use CMD. To make this more convenient, I like to copy the jar and the pom files into one directory and navigate into this directory.


The source folder


Now we install the artifact (the jar + pom) to our local maven repository. The command is fairly easy.


Install the ENV.jar into your local maven repository



mvn install:install-file -DpomFile=ENV.pom -Dfile=ENV.jar

That's it! We can now go to our CCO plugin pom.xml and use the ENV.jar as dependency.


Added ENV.jar as dependency


But wait, there are still some errors?


Missing packages


So maven tries to retrieve all dependencies mentioned in the ENV.pom from public maven repositories, but as I already mentioned, some packages CCO uses, are not publicly available.

Therefore we install them like we installed the ENV.jar with one difference:

We do not have a pom xml for them, so we need to explicitly set the groupId, artifactId and version of the package. All of the three missing packages should be available in the envLib folder.


Missing packages


We need to determine the groupId, artifactId and version of this packages. ArtifactId is fairly easy. It is e.g. Likey. Version is also easy e.g. 1.0.0. But what is the groupId?

Open the ENV.pom and search for e.g. Likey.


Likey package


Now we have all necessary information available to install these missing packages into our local repository.


Installed Likey



mvn install:install-file -Dfile=Likey-1.0.0.jar -DgroupId=com.sap.security.core.server -DartifactId=Likey -Dversion=1.0.0 -Dpackaging=Jar

Now proceed with the two missing packages in the same way.
mvn install:install-file -Dfile=com.sap.js.passport.api-1.2.0.jar -DgroupId=com.sap.core.jdsr -DartifactId=com.sap.js.passport.api -Dversion=1.2.0 -Dpackaging=Jar
mvn install:install-file -Dfile=worm_api-5.5.4.jar -DgroupId=de.swissbit.tse -DartifactId=worm_api -Dversion=5.5.4 -Dpackaging=Jar

 

When we go back to our IDE and try to import the dependencies again, everything should run smoothly.


Sync successful


That is all. You are now able to develop like you used to prior FP13 and will have all packages available Customer Checkout is using.

If you have any further questions, please leave a comment. If you liked this short guide, feel free to like and share as it may help others.

 
11 Comments