Project Layout 1.4.2-SNAPSHOT API

Project Layout

Project Layout is a small utility library for describing and working with conventional project directory layouts—including sources, resources, tests, and documentation—in a consistent way. It is intended for build tooling and plugins that need to locate well-known folders reliably across different projects. Project Layout supports all types of project files, including source code, documentation, project site content, and other relevant files.

Architecture and behavior

The API has two cooperating layers. ProjectLayoutManager detects the project type and creates a configured ProjectLayout, while ProjectProcessor provides reusable recursive processing of a project and its discovered modules. The layout abstraction keeps consumers independent of build-system-specific metadata and path conventions.

ProjectLayoutManager checks pom.xml, build.gradle, package.json, and pyproject.toml, in that order, and selects the matching Maven, Gradle, JavaScript/TypeScript, or Python implementation. An existing directory without a recognized descriptor uses the filesystem-based DefaultProjectLayout; a missing directory is rejected.

Every ProjectLayout is configured with a project root and exposes root-relative locations for production sources, tests, and documentation, as well as module and project identity information where the underlying metadata supplies it. Maven layouts read POM build roots, resources, coordinates, parent information, and modules. Gradle layouts use the Tooling API for project and child-module names and conventional source roots. JavaScript/TypeScript layouts discover array-form package workspaces, and Python layouts recognize public named projects declared in pyproject.toml. The default layout uses filesystem conventions. Callers should resolve returned path strings against the configured project root.

To process a repository, extend ProjectProcessor and implement its folder-processing operation. The processor applies that operation to a leaf project, or traverses the modules reported by a parent layout. This makes one operation reusable across a repository and its discovered child projects. A null module list identifies a leaf and invokes the processing hook; an empty module list identifies a parent with no modules and does not invoke it.

Principal types

The following class diagram shows the principal detection, processing, and layout types. It illustrates how ProjectLayoutManager and ProjectProcessor use the common ProjectLayout abstraction and its Maven, Gradle, JavaScript/TypeScript, Python, and default implementations.

Class diagram showing ProjectLayoutManager and ProjectProcessor working with ProjectLayout and its Maven, Gradle, JavaScript, Python, and default implementations.

Packages

org.machanism.machai.project
Coordinates project-layout detection and caller-defined recursive processing of projects and their modules. ProjectLayoutManager selects a layout using deterministic descriptor precedence, and ProjectProcessor supplies the traversal workflow and processing extension point.
org.machanism.machai.project.layout
Defines the common project-layout abstraction, Maven, Gradle, JavaScript/TypeScript, Python, and fallback implementations, and Maven descriptor support. Layouts provide root-relative source, test, and documentation locations, metadata-derived identity, module discovery where supported, and shared filesystem utilities. PomReader parses and serializes Maven models.
Packages
Package
Description
Detects project layouts and traverses their module trees.
APIs for detecting and describing a repository's on-disk project layout.