Skip to content

How To: Add dependency to project

Alexander Dümont edited this page Oct 2, 2024 · 4 revisions

This guide explains how to integrate the SAP Cloud SDK for AI into your Java project.

In pom.xml add the necessary dependencies as you see fit.

  <dependencies>
    <!-- scope "compile" -->
    <dependency>
      <groupId>com.sap.ai.sdk</groupId>
      <artifactId>core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.sap.ai.sdk.foundationmodels</groupId>
      <artifactId>openai</artifactId>
    </dependency>
    <dependency>
      <groupId>com.sap.ai.sdk</groupId>
      <artifactId>orchestration</artifactId>
    </dependency>

Options:

  • Released artifacts on Maven Central

    Currently we're still in development. We have not yet released the product.

  • Local Repository Checkout

    Download repository for a specific branch, tag or main by default. Compile the project locally. Let Maven install the compiled code to local Maven repository.

  • Use SNAPSHOT Version (internal only)

    Connect to SAP Common Artifactory, by adjusting the local user settings.xml file. SNAPSHOT releases are done with inconsistent schedule / on demand.

    Step 1: Create an identity token via Artifactory Common website user interface.

    Login to the web UI via certificate or credentials. Click on the "Generate an Identity Token" button. Store the secret 64 char reference token somewhere safe, it will be used in Step 2.

    image

    Step 2: Locate and alter the ~/.m2/settings.xml file to feature the credentials.

    The settings.xml file defines server credentials globally and repository URLs according to profile artifactory.common (active by default):

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
      <servers>
          <server>
              <username>[D/I number]</username>
              <password>[token ~64chars]</password>
              <id>artifactory-common</id>
          </server>
      </servers>
      <profiles>
          <profile>
              <id>artifactory.common</id>
              <pluginRepositories>
                  <pluginRepository>
                      <id>artifactory-common</id>
                      <url>https://common.repositories.cloud.sap/artifactory/build-snapshots-cloudsdk/</url>
                  </pluginRepository>
              </pluginRepositories>
              <repositories>
                  <repository>
                      <id>artifactory-common</id>
                      <url>https://common.repositories.cloud.sap/artifactory/build-snapshots-cloudsdk/</url>
                  </repository>
              </repositories>
          </profile>
      </profiles>
      <activeProfiles>
          <activeProfile>artifactory.common</activeProfile>
      </activeProfiles>
    </settings>
Clone this wiki locally