use of com.buschmais.jqassistant.scm.maven.configuration.MavenConfiguration in project jqa-maven-plugin by jQAssistant.
the class AnalyzeMojo method aggregate.
@Override
public void aggregate(MojoExecutionContext mojoExecutionContext) throws MojoExecutionException, MojoFailureException {
MavenConfiguration configuration = mojoExecutionContext.getConfiguration();
MavenProject rootModule = mojoExecutionContext.getRootModule();
RuleSet ruleSet = readRules(mojoExecutionContext);
Analyze analyze = configuration.analyze();
RuleSelection ruleSelection = RuleSelection.select(ruleSet, analyze.groups(), analyze.constraints(), analyze.concepts());
File outputDirectory = mojoExecutionContext.getOutputDirectory();
withStore(store -> analyze(configuration, rootModule, ruleSet, ruleSelection, store, outputDirectory), mojoExecutionContext);
}
use of com.buschmais.jqassistant.scm.maven.configuration.MavenConfiguration in project jqa-maven-plugin by jQAssistant.
the class AbstractMojo method execute.
@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
if (!runtimeInformation.isMavenVersion("[3.5,)")) {
throw new MojoExecutionException("jQAssistant requires Maven 3.5.x or above.");
}
// parallel builds
synchronized (AbstractMojo.class) {
MavenConfiguration configuration = getConfiguration();
MojoExecutionContext mojoExecutionContext = new MojoExecutionContext(session, currentProject, configuration);
MavenProject rootModule = mojoExecutionContext.getRootModule();
Set<MavenProject> executedModules = getExecutedModules(rootModule);
if (configuration.skip()) {
getLog().info("Skipping execution.");
} else {
if (isResetStoreBeforeExecution() && executedModules.isEmpty()) {
withStore(store -> store.reset(), mojoExecutionContext);
}
execute(mojoExecutionContext, executedModules);
}
executedModules.add(currentProject);
}
}
use of com.buschmais.jqassistant.scm.maven.configuration.MavenConfiguration in project jqa-maven-plugin by jQAssistant.
the class ScanMojo method execute.
@Override
public void execute(MojoExecutionContext mojoExecutionContext, MavenProject mavenProject) throws MojoExecutionException, MojoFailureException {
MavenConfiguration configuration = mojoExecutionContext.getConfiguration();
File outputDirectory = mojoExecutionContext.getOutputDirectory();
withStore(store -> scan(mavenProject, configuration, store, outputDirectory), mojoExecutionContext);
}
use of com.buschmais.jqassistant.scm.maven.configuration.MavenConfiguration in project jqa-maven-plugin by jQAssistant.
the class AbstractMojo method withStore.
/**
* Execute an operation with the store.
* <p>
* This method enforces thread safety based on the store factory.
*
* @param storeOperation
* The store.
* @throws MojoExecutionException
* On execution errors.
* @throws MojoFailureException
* On execution failures.
*/
protected final void withStore(StoreOperation storeOperation, MojoExecutionContext mojoExecutionContext) throws MojoExecutionException, MojoFailureException {
MavenProject rootModule = mojoExecutionContext.getRootModule();
MavenConfiguration configuration = mojoExecutionContext.getConfiguration();
Store store = getStore(configuration, () -> storeDirectory != null ? storeDirectory : new File(rootModule.getBuild().getDirectory(), STORE_DIRECTORY));
try {
storeOperation.run(store);
} finally {
releaseStore(store);
}
}
Aggregations