Class MavenProjectLayout
java.lang.Object
org.machanism.machai.project.layout.ProjectLayout
org.machanism.machai.project.layout.MavenProjectLayout
A Maven-specific implementation for project layout.
Supports detection of modules, sources, documents, and tests within Maven projects by parsing pom.xml and its effective model.
- Since:
- 0.0.2
- Author:
- Viktor Tovstyi
- See Also:
-
Field Summary
Fields inherited from class org.machanism.machai.project.layout.ProjectLayout
EXCLUDE_DIRS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioneffectivePomRequired(boolean effectivePomRequired) Enables/disables effective POM calculation for module resolution.Returns a list of documentation sources for Maven projects.org.apache.maven.model.ModelgetModel()Returns the current Maven Model (parsedpom.xml).Returns a list of modules for Maven projects if packaging ispom.Returns a list of source directories by inspecting the Maven build section.getTests()Returns a list of test directories by inspecting the Maven build section.static booleanisMavenProject(File projectDir) Checks if the given directory is a Maven project by looking forpom.xml.model(org.apache.maven.model.Model model) Sets the Maven Model for chaining configuration.Methods inherited from class org.machanism.machai.project.layout.ProjectLayout
getProjectDir, getRelatedPath, getRelatedPath, getRelatedPath, projectDir
-
Constructor Details
-
MavenProjectLayout
public MavenProjectLayout()
-
-
Method Details
-
isMavenProject
Checks if the given directory is a Maven project by looking forpom.xml.- Parameters:
projectDir- The directory to check- Returns:
- true if
pom.xmlexists; false otherwise
-
getModules
Returns a list of modules for Maven projects if packaging ispom.- Overrides:
getModulesin classProjectLayout- Returns:
- List of module names, or
nullif not a multi-module Maven project - See Also:
-
getModel
public org.apache.maven.model.Model getModel()Returns the current Maven Model (parsedpom.xml).- Returns:
- Parsed Maven Model for this project
- See Also:
-
model
Sets the Maven Model for chaining configuration.- Parameters:
model- The model to set- Returns:
- this object (for method chaining)
-
effectivePomRequired
Enables/disables effective POM calculation for module resolution.- Parameters:
effectivePomRequired- true to enable, false otherwise- Returns:
- this object (for method chaining)
-
getSources
Returns a list of source directories by inspecting the Maven build section.- Specified by:
getSourcesin classProjectLayout- Returns:
- List of source directories defined in Maven
pom.xmlExample usage: MavenProjectLayout layout = new MavenProjectLayout(); List
sources = layout.projectDir(new File("/repo")).getSources();
-
getDocuments
Returns a list of documentation sources for Maven projects.- Specified by:
getDocumentsin classProjectLayout- Returns:
- List of documentation sources (default:
src/site)
-
getTests
Returns a list of test directories by inspecting the Maven build section.- Specified by:
getTestsin classProjectLayout- Returns:
- List of test source directories defined in Maven
pom.xml
-