Package org.machanism.machai.project.layout
package org.machanism.machai.project.layout
APIs for detecting and describing a repository's on-disk project layout.
A ProjectLayout represents a configured project root and exposes
conventional locations as paths relative to that root. The concrete implementations in this package adapt that
common API to Maven, Gradle, JavaScript/TypeScript, Python, and unknown project structures. Callers should configure
the root with ProjectLayout.projectDir(java.io.File) before querying a
layout.
Responsibilities
- Expose production-source, test-source, and documentation directories as root-relative paths.
- Discover child modules from build metadata or filesystem conventions where the ecosystem supports it.
- Provide project identifiers, names, parent identifiers, and a layout type when the underlying metadata supplies them.
- Offer shared path, directory-scanning, exclusion, and temporary-directory utilities through
ProjectLayout. - Parse Maven descriptors and serialize Maven models with
PomReader.
Supported layouts
MavenProjectLayoutreadspom.xml, including Maven modules, build source roots, resources, tests, project coordinates, and parent coordinates.GradleProjectLayoutuses the Gradle Tooling API for project and child-module names and supplies conventionalsrc/main,src/test, andsrc/siteroots.JScriptProjectLayoutreadspackage.jsonworkspace globs and identifies matching workspace directories containing their own package descriptor.PythonProjectLayoutrecognizes public projects described bypyproject.toml; source, test, and documentation discovery currently returns empty collections.DefaultProjectLayoutprovides a filesystem fallback that treats non-excluded immediate subdirectories as module candidates and returns empty location collections.
Typical usage
java.io.File projectDir = new java.io.File("repo");
ProjectLayout layout = new MavenProjectLayout().projectDir(projectDir);
java.util.Collection<String> sources = layout.getSources();
java.util.Collection<String> tests = layout.getTests();
java.util.List<String> modules = layout.getModules();
Returned paths are intended to be resolved against projectDir. A layout may return null for modules
when the project is not a parent project; callers should therefore handle that result according to the selected
implementation's contract.
-
ClassesClassDescriptionMinimal fallback
ProjectLayoutimplementation.A Gradle-specificProjectLayoutimplementation.A project layout utility for JavaScript/TypeScript-based projects.A Maven-specificProjectLayoutimplementation.Utility for reading and processing Mavenpom.xmlfiles into Maven models.Base abstraction for describing a project's conventional on-disk layout.Project layout implementation for Python-based projects.