Installing Command Line Maven

Introduction

In many cases, you do not need a command-line Maven installation to develop and run StreamBase applications in StreamBase Studio, or to deploy EventFlow fragments in a StreamBase Runtime node with the epadmin command. Studio uses its own internal implementation of Maven, and epadmin does not call the mvn command.

You do need a command-line Maven installation, independent of Studio's built-in Maven, in order to install third-party JARs into your local Maven repository. This process is described on Using External JAR Files.

The test for a successful Maven installation is whether you can get a valid response from a mvn --version command.

Installing Command Line Maven on Windows

To install command-line Maven on Windows, download and install Maven from the Apache Maven site, as described on that site. Be sure to add the bin directory of your Maven installation to the system PATH.

Maven is a Java program and thus requires a Java installation. Install or configure Java for your machine as described on the previous page.

You are welcome to use a third-party command-line environment such as the Linux-like environment provided by Cygwin. At this writing, Cygwin does not provide a native Maven installer, so you still must download and install Maven from the Apache site.

The primary caution about using the Cygwin, MSys, or the Windows 10 Ubuntu subsystems is to make sure the subsystem has the same sense of home directory as the Windows command prompt. StreamBase Studio's embedded Maven writes to a critically important local repository stored by default in your Windows home directory, in a folder named .m2. If your Linux-like subsystem has a different meaning for your home directory, then it might try to create and use a different .m2 directory in a different location. You can set environment variables to reconcile the meaning of HOME in the various systems. As an alternative, you can set up custom settings.xml files for your different Maven installations to make sure they use the same local repository directory. See the online Maven documentation for further details.

Installing Command Line Maven on macOS

Apple does not provide Maven by default for command-line use of the mvn command. You must download and install Maven to your Mac.

  • You can download Maven for macOS from the Apache Maven site, as described on that site. Be sure to add the bin directory of your Maven installation to the system PATH.

  • If you use a third-party package management system such as Homebrew or MacPorts, you can use that system's commands to locate, install, and configure command-line Maven for you.

    If you have never used a package manager for macOS, consider installing Homebrew with a single command described on its home page. Then from a Terminal shell prompt, type brew install maven. Homebrew first downloads and installs the XCode Command Line Tools from Apple if they are not already installed, then locates Maven and installs it for you.

Installing Command Line Maven on Linux

On most Linux systems, use your system's package manager to install Maven.

On Red Hat Linux, you may have to download a Maven archive package from the Apache Maven download site and install it as described on that site.