Forge
How-to guides

Publish a resource

Build the registry and publish a resource, as a snapshot or as a release.

Publication turns the resource zip and the plugin zip in build/distributions/ into Maven artifacts, one per resource and one per plugin, each with a POM carrying its metadata and dependencies. The other files in that folder reach no Maven repository; see Build outputs.

configure.publishing and configure.repositories both default on, so most projects write neither.

Snapshots against releases

The version in resource.humanVersion picks the destination repository. A version ending in -SNAPSHOT goes to the snapshots repository; anything else goes to releases.

com.mbseconsulting.forge.resource.humanVersion=8.9.27-SNAPSHOT

Three tasks act on that split:

TaskPublishes
publishSnapshotsEvery snapshot publication
publishReleasesEvery release publication
publishAllWhichever of the two matches the current version

Publish

./gradlew createRegistry
./gradlew assemble
./gradlew publishAll

createRegistry scans the configured repositories and any external index, then writes registry.json, which is what resolves resource-to-resource and plugin-to-plugin dependencies into POM entries. It scans a local directory, Nexus 3 or Artifactory, and fails on any other remote repository; the repository keys state the URL shapes it recognizes. assemble writes build/publication/publication-index.json, describing what this project built.

Why the first run takes two passes

Forge creates its publications from those two JSON files at configuration time. On a first run they do not exist yet, so Gradle configures no publications and publishAll has nothing to do.

Run createRegistry and assemble first, then invoke publishAll as a separate command. The second invocation reads the files the first produced and creates the publications. Combining them into one command does not work, because configuration happens before any task executes.

Once the files exist, later builds publish in one pass.

What lands in the POM

Each publication carries custom <properties> holding the artifact's metadata, and <dependencies> holding the resource and plugin dependencies resolved against registry.json. That is what lets installCatiaMagicDependencies resolve a full graph in a consuming project. See The dependency model.

Publishing Forge itself

Releasing the plugin follows a different procedure, documented for Forge's maintainers in the repository's release runbook.

On this page