/*
* Loads and parses components from the project and its dependencies
*/
ErrorReport parsingResult = new ErrorReport(getLog());
MavenProjectRepository projectRepository = new MavenProjectRepository(project, includeMavenDependencies, ApamMavenProperties.mavenVersion, parsingResult);
getLog().info("ApAM metadata manipulator");
/*
* The components to verify
*/
List<ComponentDeclaration> components = projectRepository.getBuildRepository().getComponents();
if (components.isEmpty()) {
throw new InvalidApamMetadataException("No Apam metadata");
}
ErrorReport acrParsingResult = new ErrorReport(getLog());
ApamComponentRepository acr = null;
try {
acr = new ApamComponentRepository(mockManager(getInputRepositoryLocations()),getInputRepositoryLocations(),acrParsingResult);
} catch (Exception exc) {
exc.printStackTrace();
throw new MojoExecutionException("Exception during initialize of OBR/ACR repositories "+exc.getMessage());
}
/*
* Validate components, we validate first the most abstract components so that if there are cross-references
* among components in the same build we detect errors soon and avoid cascaded errors
*/
ValidationContext context = new ValidationContext(new RepositoryChain(projectRepository,acr));
Validator validator = new Validator(projectRepository.getClasspath(),context);
ErrorReport validatorResult = new ErrorReport(getLog());
for (ComponentDeclaration component : components) {
if (component instanceof SpecificationDeclaration) {