Maven Projects in StreamBase Studio

Maven Introduction

StreamBase® Studio uses the Maven project format provided by Eclipse. Maven is a software build and management system aimed primarily at Java developers, but adapted by Spotfire to develop EventFlow and LiveView fragments as well.

StreamBase Studio projects are in Maven project format, and all projects are built and run under Maven control. The Run As context menu includes several Maven commands and goals.

Using Maven provides a well-known, thoroughly documented, and standard way to specify project dependencies, both within and external to the project. Maven automatically configures search paths for code in specified dependencies, and also manages resource search paths automatically.

StreamBase documentation does not attempt to describe Maven beyond the summary on this page. See the official Maven documentation at maven.apache.org, or one of many fine books on the subject.

Maven Artifacts

The Maven system assumes that each product produces an artifact as the output of its build. The artifact produced by a standard Java project is usually a JAR file. The artifact produced by a StreamBase EventFlow project is an EventFlow fragment archive. This is a .zip file that contains your EventFlow modules and resources in runnable format.

Likewise, the artifact produced by a LiveView project is a LiveView fragment archive.

When Maven is run, it follows the directions in the project's Project Object Model, which is defined in an XML file at the root of each project folder named pom.xml. The StreamBase POM files can be run both in Studio and at the command prompt with the mvn command, if your system has a recent installation of command-line Maven installed.

The Maven POM defines a fixed lifecycle for the stages of building an EventFlow project. You can specify any stage as a goal when you run Maven. This automatically runs all defined stages prior to the specified goal. For a project in good shape, you only need to specify the two goals clean install, which runs all the stages of cleaning your project folder, then runs all the stages of compiling, packaging, verifying, and unit-testing your project before running the install stage.

For StreamBase projects, the install goal means that an EventFlow fragment archive for your project is generated and copied into your project's target folder. The goal goes on to copy that file to your local Maven repository. Likewise for LiveView projects, the install goal means to generate a LiveView fragment archive file in the target folder, and to then copy the archive file to the local Maven repository.

By default, the local Maven repository is the .m2 folder in your home directory on your local machine. Your site might prefer to configure a central local repository.

Maven Project Format

Each EventFlow fragment project in Studio has a project structure defined by Maven standards. When you create a project with File>New>StreamBase Project>EventFlow Fragment, Studio generates a project format much like the following:

If you create a LiveView project with File>New>StreamBase Project>LiveView Fragment, the new project contains an additional folder, src/main/liveview.

The folders at the top of the project are convenience links to actual file system objects. The only folders actually created on the file system are the src and target folders and the pom.xml file.

See What Goes Where to determine where to place different file types in your Maven-format project folders in Studio.