GuidesChangelogData Inspector Library API Reference
Guides

Install the OLP CLI

Install the OLP CLI

This section describes how to install and configure the OLP CLI and start using it to access the HERE platform services.

System requirements

The following operating systems are supported:

  • Windows 10 or higher
  • Linux (Ubuntu 20.04 or higher)
  • macOS Sierra or higher

The OLP CLI requires the Java Runtime Environment (JRE) version 17 or above.

Note

JRE version

To determine the version installed on your machine, run the java -version command in a terminal window.

Use winget package manager

The winget package manager enables Windows users to discover, install, upgrade, and remove the OLP CLI.

Java package

If the OLP CLI has been installed with the winget package manager, the image of OpenJDK 17 has been packed with it and is used for the command execution. There is no need to install another JRE or JDK.

To install the OLP CLI using winget, run the following command:

winget install HERE.OLPCLI

To upgrade the OLP CLI using winget, run the following command:

winget upgrade HERE.OLPCLI

To remove the OLP CLI using winget, run the following command:

winget uninstall HERE.OLPCLI

Use OLP CLI installer

The installer is the recommended solution for Windows users.

To install the OLP CLI using the Windows installer, download the OLP CLI from the platform portal and install using GUI.

The installer takes care of setting up the PATH environment and informs you about a new version if you rerun the installer.

To upgrade the OLP CLI, run the command prompt as administrator and execute the following command:

olp version update

To remove the OLP CLI, follow the steps below:

  • Select Start, then select Settings > Apps > Apps & features.
  • Select the OLP CLI, and then press Uninstall.

Use apt package manager

The apt package manager enables users of Debian-based distributions to discover, install, upgrade, and remove the OLP CLI.

If the OLP CLI has been installed with the apt package manager, the image of OpenJDK 17 has been packed with it and is used for the command execution. There is no need to install another JRE or JDK.

To install the OLP CLI using apt, run the following commands:

  • Add the HERE Platform Debian repository where olp-cli Debian package is published
echo "deb https://repo.platform.here.com/artifactory/debian stable main" | sudo tee /etc/apt/sources.list.d/olp-cli.list
  • Install GPG key from the HERE Platform Debian repository
curl -fsSL https://repo.platform.here.com/artifactory/api/gpg/key/public | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/olp-cli.gpg > /dev/null
  • Update package information and install OLP CLI package
sudo apt-get update
sudo apt-get install olp-cli

Note

Required processor architecture

For the OLP CLI installation with the apt package manager, processor architecture amd64 is required.

To upgrade the OLP CLI using apt, run the following command:

sudo apt-get update
sudo apt-get install olp-cli

To remove the OLP CLI using apt, run the following command:

sudo apt-get remove olp-cli

Use Homebrew

Homebrew is a package manager for macOS and Linux. You can use it to install the latest version of the OLP CLI as follows:

brew install heremaps/olp-cli/olp

If you want to update the OLP CLI, run the following command:

brew upgrade olp

To remove the package, use the following command:

brew uninstall olp

Use OLP CLI ZIP archive

To install the OLP CLI from the ZIP archive, download the ZIP archive from the platform portal and follow the steps below:

  • Unzip the archive to the folder.
  • On Linux, add the full path to the folder with the olp file to your PATH environment variable and export it to the .bash_profile file, which is a hidden file that contains configurations scripts and environment variables, that runs when bash is invoked.
  • On Windows, add the full path to the folder with the olp.bat file to your PATH environment variable.

To upgrade the OLP CLI, run the command prompt as administrator and execute the following command:

olp version update

To remove the OLP CLI, follow the steps below:

  • Remove OLP CLI from the PATH environment variable which has been set up by the instructions above.
  • Delete the folder with the CLI binaries.

Install the OLP CLI in your CI/CD environment

The recommended way to install the OLP CLI in a CI/CD environment is through Maven, as follows:

  1. Download and configure your repository credentials.

  2. Create an OLP_TOOLS environment variable that contains the path to where you want to download the OLP CLI:

   OLP_TOOLS=user/olp_tools
   mvn dependency:unpack -Dartifact=com.here.platform:cli_2.13:LATEST:zip -DoutputDirectory=\$OLP_TOOLS
   set OLP_TOOLS=C:/user/olp_tools
   mvn dependency:unpack -Dartifact=com.here.platform:cli_2.13:LATEST:zip -DoutputDirectory=%OLP_TOOLS%

Run the following commands if you want to install the OLP CLI less than or equal to the 9.3.9 version:

   OLP_TOOLS=user/olp_tools
   mvn dependency:unpack -Dartifact=com.here.platform:cli:LATEST:zip -DoutputDirectory=\$OLP_TOOLS
   set OLP_TOOLS=C:/user/olp_tools
   mvn dependency:unpack -Dartifact=com.here.platform:cli:LATEST:zip -DoutputDirectory=%OLP_TOOLS%
  1. Add the directory with the OLP CLI to your PATH variable:
   export PATH="$PATH:$OLP_TOOLS"
   cd %OLP_TOOLS%
   set PATH=%cd%;%PATH%

The newly updated PATH variable is only visible to all child processes.

Now OLP CLI is installed. To access it from the command line, type: olp [command].

You can integrate the OLP CLI with your CI/CD environment using automation scripts. For more information, see Scripting Tips.

Install an older version of the OLP CLI

We recommend to always use the latest version of the OLP CLI to stay up to date with the most recent HERE platform features. However, if, for some reason, you need an older version of the OLP CLI, use Maven to download it, as follows:

  1. Download and configure your repository credentials.
  2. Run the commands below. The OLP_CLI_VERSION parameter must be greater than the 9.3.9 version.
   OLP_CLI_DIR=<path/to/directory>
   OLP_CLI_VERSION=<desired-cli-version>
   mvn dependency:unpack -Dartifact=com.here.platform:cli_2.13:$OLP_CLI_VERSION:zip -DoutputDirectory=$OLP_CLI_DIR -Dmdep.overWriteReleases=true
   set OLP_CLI_DIR=<path/to/directory>
   set OLP_CLI_VERSION=<desired-cli-version>
   mvn dependency:unpack -Dartifact=com.here.platform:cli_2.13:%OLP_CLI_VERSION%:zip -DoutputDirectory=%OLP_CLI_DIR% -Dmdep.overWriteReleases=true

Run the following command if you want to install the OLP CLI less than or equal to the 9.3.9 version:

   OLP_CLI_DIR=<path/to/directory>
   OLP_CLI_VERSION=<desired-cli-version>
   mvn dependency:unpack -Dartifact=com.here.platform:cli:$OLP_CLI_VERSION:zip -DoutputDirectory=$OLP_CLI_DIR -Dmdep.overWriteReleases=true
   set OLP_CLI_DIR=<path/to/directory>
   set OLP_CLI_VERSION=<desired-cli-version>
   mvn dependency:unpack -Dartifact=com.here.platform:cli:%OLP_CLI_VERSION%:zip -DoutputDirectory=%OLP_CLI_DIR% -Dmdep.overWriteReleases=true

For the list of released CLI versions, see the Changelog.

Use OLP CLI in Java and Scala projects

To execute OLP CLI commands in your Java/Scala applications, you can use the com.here.platform.cli.CliRunner class:

  /**
  * The CliRunner class provides methods for executing OLP CLI commands.
  */
  public class CliRunner {

      /**
      * Executes provided OLP CLI command
      *
      * @param args The arguments for the command.
      * @return The result of executing the command.
      */
      public static ExecutionResult executeCommand(String[] args)

      /**
      * Executes a CLI command with the provided arguments and logger.
      *
      * @param args   The arguments for the command.
      * @param logger The logger to use for logging intermediate messages. Can be {@code null}.
      * @return The result of executing the command.
      */
      public static ExecutionResult executeCommand(String[] args, Logger logger)
    }

It allows you to execute OLP CLI command and get the com.here.platform.cli.ExecutionResult object containing successResponse, errorResponse and statusCode properties that can be used for further processing.

To execute OLP CLI commands in Java/Scala applications, follow the steps below:

  1. Add the OLP CLI thin jar to the dependency:

   <dependency>
     <groupId>com.here.platform</groupId>
     <artifactId>cli_2.13</artifactId>
     <version>${olp-cli.version}</version>
     <classifier>thin</classifier>
   </dependency>
   "com.here.platform" %% "cli" % "${olp-cli.version}" classifier "thin"
  1. Run the CliRunner.executeCommand(command) or CliRunner.executeCommand(command, logger) method:

package org.example;

import com.here.platform.cli.CliRunner;
import com.here.platform.cli.ExecutionResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class App {
    static Logger logger = LoggerFactory.getLogger(App.class);
    public static void main(String[] args) {
        String[] apiListCommand = {"api", "list", "--quiet"};
        ExecutionResult executionResult = CliRunner.executeCommand(apiListCommand, logger);
        if (executionResult.getStatusCode() == 0) {
            logger.info(executionResult.getSuccessResponse());
        } else {
            logger.error(executionResult.getErrorResponse());
        }
    } 
}

package org.example

import com.here.platform.cli.{CliRunner, ExecutionResult}
import org.slf4j.{Logger, LoggerFactory}

object App {
  val logger: Logger = LoggerFactory.getLogger(App.getClass)

  def main(args: Array[String]): Unit = {
    val apiListCommand: Array[String] = Array("api", "list", "--quiet")
    val executionResult: ExecutionResult = CliRunner.executeCommand(apiListCommand, logger)
    if (executionResult.getStatusCode == 0) {
      logger.info(executionResult.getSuccessResponse)
    } else {
      logger.error(executionResult.getErrorResponse)
    }
  }
}

Note

Experimental

CliRunner is still in the experimental phase and may have some areas under development.