com.lewisd.maven.lint.ProjectModels Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lint-maven-plugin Show documentation
Show all versions of lint-maven-plugin Show documentation
Generates a report of suspicious/inconsistent POM elements, and optionally fails the build if violations are found.
The newest version!
package com.lewisd.maven.lint;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.apache.maven.project.MavenProject;
public class ProjectModels {
private final Map models = new HashMap();
private final Map modelBuilders;
public ProjectModels(MavenProject mavenProject, Map modelBuilders) {
models.put("mavenProject", mavenProject);
this.modelBuilders = modelBuilders;
}
public Map getModels(final Set requiredModels) {
Map ruleModels = new HashMap();
for (String modelId : requiredModels) {
Object model = models.get(modelId);
if (model == null) {
ModelBuilder modelBuilder = modelBuilders.get(modelId);
if (modelBuilder == null) {
throw new IllegalArgumentException("No modelBuilder known for modelId '" + modelId + "'");
}
Map dependentModels = getModels(modelBuilder.getRequiredModels());
model = modelBuilder.buildModel(dependentModels);
models.put(modelId, model);
}
ruleModels.put(modelId, model);
}
return ruleModels;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy