Installation
This page covers the three things you need before building a component: a per-language
toolchain, the ggcommons scaffolding CLI, and the library dependency wired into your
project. The CLI normally wires the dependency for you when it scaffolds a component — the manual
declarations below are for adding GGCommons to a project by hand.
Toolchain prerequisites
Section titled “Toolchain prerequisites”GGCommons is one SDK in four languages. You only need the toolchain for the language you build in.
Java 25 (LTS) and Maven. The published SDK artifact is built for Java 25, so a JDK 25 is required even though a generated component compiles its own bytecode to level 11.
java -version # expect 25.xmvn -version # any recent Maven 3.xPython 3.9 or newer for components.
python3 --version # expect 3.9 or newerA Rust toolchain installed via rustup, plus cargo.
rustc --version # 1.85 or newer recommendedcargo --versionNode.js 18 or newer and npm.
node --version # expect v18 or newernpm --versionBeyond the language toolchain, you will want git, a local MQTT broker for HOST-platform testing, and — for packaging/deploying to Greengrass — the GDK (Greengrass Development Kit).
Install the scaffolding CLI
Section titled “Install the scaffolding CLI”The CLI is the Python package ggcommons-cli. It installs two identical console entry points,
ggcommons and ggcommons-cli. Templates are bundled into the wheel, so an installed CLI
scaffolds offline.
pipx install ./cli # recommended: isolated global `ggcommons`# or: python3 -m pip install ./cli# or: python3 -m pip install -e ./cli # editable, for developing the CLI itselfpipx install ./cli # recommended: isolated global ggcommons# or: python -m pip install ./cli# or: python -m pip install -e ./cli # editable, for developing the CLI itselfVerify your environment
Section titled “Verify your environment”ggcommons doctor checks for the eight tools the CLI can use — git, gdk, cargo, mvn,
python3 (or python), node, npm, and aws — and prints [ok] <name> -> <path> or
[missing] <name> for each. It reports status only and does not fail when a tool is missing, so
a missing entry is only a problem if you need that tool for your language or workflow.
ggcommons doctorggcommons doctorAdd the library to a project
Section titled “Add the library to a project”When you scaffold with ggcommons create-component, the dependency is written for you. The
--dep-source flag chooses between two forms:
local(the default) — a path dependency on a monorepo checkout of the library. Best for developing against the SDK in this repo, and it needs no registry access.registry— the published artifact, resolved from a registry.
The declarations below show what each form looks like if you are adding GGCommons to an existing
project by hand. The current published version is 0.1.0 (the value the CLI substitutes for the
<<GGCOMMONS_VERSION>> token).
Coordinate com.mbreissi:ggcommons. Add the dependency to your pom.xml:
<dependency> <groupId>com.mbreissi</groupId> <artifactId>ggcommons</artifactId> <version>0.1.0</version></dependency>Registry — resolve from GitHub Packages by adding the repository and authenticating in
~/.m2/settings.xml with a <server> whose <id> is github and a GitHub token that has the
read:packages scope:
<repositories> <repository> <id>github</id> <url>https://maven.pkg.github.com/mbreissi/ggcommons</url> </repository></repositories>Local — build the library from the monorepo and install it to your local Maven cache, then the
same coordinate resolves from ~/.m2 with no repository configured:
cd libs/java && mvn clean installPackage greengrass-commons. A scaffolded component lists it (unpinned) in requirements.txt:
greengrass-commonsInstall with:
pip install -r requirements.txtCrate ggcommons. The dependency form is chosen by --dep-source; in Cargo.toml:
[dependencies]# local (dev default): a path dependency on the monorepo checkoutggcommons = { path = "/abs/path/to/libs/rust", default-features = false }
# registry: the published artifact via a git tag# ggcommons = { git = "https://github.com/mbreissi/ggcommons", tag = "rust-lib/v0.1.0", default-features = false }For the local form, the CLI fills the path from --ggcommons-path (defaulting to the in-repo
libs/rust). Off-by-default cargo features (greengrass, cloudwatch, streaming,
credentials, parameters, …) are composed on top as your component needs them.
Package @mbreissi/ggcommons (note the scope — it is not a bare ggcommons). The dependency
form is chosen by --dep-source; in package.json:
{ "dependencies": { "@mbreissi/ggcommons": "file:/abs/path/to/libs/ts" }}For the local form above, the value is file:<path> (the CLI fills it from --ggcommons-path,
defaulting to the in-repo libs/ts). Install local path deps with npm install --install-links so
the package is copied rather than symlinked.
Registry — use a semver range and resolve the @mbreissi scope from GitHub Packages. The CLI
emits an .npmrc (only for --dep-source registry) and authenticates from the NODE_AUTH_TOKEN
environment variable (a GitHub token with read:packages):
{ "dependencies": { "@mbreissi/ggcommons": "^0.1.0" }}@mbreissi:registry=https://npm.pkg.github.com//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}