Search in sources :

Example 1 with PropertiesConfigBuilder

use of com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder in project jqa-maven-plugin by jQAssistant.

the class AbstractMojo method getConfiguration.

/**
 * Retrieve the runtime configuration.
 * <p>
 * The configuration directory is assumed to be located within the execution root of the Maven session.
 *
 * @return The {@link Configuration}.
 */
protected Configuration getConfiguration() throws MojoExecutionException {
    PropertiesConfigBuilder propertiesConfigBuilder = new PropertiesConfigBuilder("MojoConfigSource", 110);
    addConfigurationProperties(propertiesConfigBuilder);
    File executionRoot = new File(session.getExecutionRootDirectory());
    return configurationProvider.getConfiguration(executionRoot, empty(), propertiesConfigBuilder.build());
}
Also used : PropertiesConfigBuilder(com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder) File(java.io.File)

Example 2 with PropertiesConfigBuilder

use of com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder in project jqa-commandline-tool by jQAssistant.

the class Main method interpretCommandLine.

/**
 * Parse the command line and execute the requested task.
 *
 * @param commandLine
 *            The command line.
 * @param options
 *            The known options.
 * @throws CliExecutionException
 *             If an error occurs.
 */
private void interpretCommandLine(CommandLine commandLine, Options options, TaskFactory taskFactory) throws CliExecutionException {
    if (commandLine.hasOption(OPTION_HELP)) {
        printUsage(options, null);
        System.exit(1);
    }
    List<String> taskNames = commandLine.getArgList();
    if (taskNames.isEmpty()) {
        printUsage(options, "A task must be specified, i.e. one  of " + gatherTaskNames(taskFactory));
        System.exit(1);
    }
    PropertiesConfigBuilder propertiesConfigBuilder = new PropertiesConfigBuilder("TaskConfigSource", 110);
    List<Task> tasks = new ArrayList<>();
    for (String taskName : taskNames) {
        Task task = taskFactory.fromName(taskName);
        try {
            task.withStandardOptions(commandLine, propertiesConfigBuilder);
            task.withOptions(commandLine, propertiesConfigBuilder);
        } catch (CliConfigurationException e) {
            printUsage(options, e.getMessage());
            System.exit(1);
        }
        if (task == null) {
            printUsage(options, "Unknown task " + taskName);
        }
        tasks.add(task);
    }
    File workingDirectory = new File(".");
    ConfigurationLoader configurationLoader = new ConfigurationLoaderImpl(workingDirectory);
    CliConfiguration configuration = configurationLoader.load(CliConfiguration.class, propertiesConfigBuilder.build());
    PluginRepository pluginRepository = getPluginRepository(configuration);
    Map<String, Object> properties = readProperties(commandLine);
    executeTasks(tasks, configuration, pluginRepository, properties);
}
Also used : PluginRepository(com.buschmais.jqassistant.core.plugin.api.PluginRepository) ConfigurationLoaderImpl(com.buschmais.jqassistant.core.configuration.impl.ConfigurationLoaderImpl) PropertiesConfigBuilder(com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder) ConfigurationLoader(com.buschmais.jqassistant.core.configuration.api.ConfigurationLoader) CliConfiguration(com.buschmais.jqassistant.commandline.configuration.CliConfiguration)

Example 3 with PropertiesConfigBuilder

use of com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder in project jqa-core-framework by jQAssistant.

the class AbstractPluginIT method getScanner.

/**
 * Return an initialized scanner instance using the given properties.
 *
 * @return The scanner instance.
 */
protected Scanner getScanner(Map<String, Object> properties) {
    PropertiesConfigBuilder propertiesConfigBuilder = createPropertiesConfigBuilder().with(Scan.PREFIX, Scan.PROPERTIES, properties);
    Configuration configuration = createConfiguration(propertiesConfigBuilder);
    return getScanner(configuration);
}
Also used : EmbeddedNeo4jConfiguration(com.buschmais.jqassistant.neo4j.backend.bootstrap.EmbeddedNeo4jConfiguration) RuleConfiguration(com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration) AnalyzerConfiguration(com.buschmais.jqassistant.core.analysis.api.AnalyzerConfiguration) StoreConfiguration(com.buschmais.jqassistant.core.store.api.StoreConfiguration) Configuration(com.buschmais.jqassistant.core.configuration.api.Configuration) PropertiesConfigBuilder(com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder)

Aggregations

PropertiesConfigBuilder (com.buschmais.jqassistant.core.configuration.api.PropertiesConfigBuilder)3 CliConfiguration (com.buschmais.jqassistant.commandline.configuration.CliConfiguration)1 AnalyzerConfiguration (com.buschmais.jqassistant.core.analysis.api.AnalyzerConfiguration)1 Configuration (com.buschmais.jqassistant.core.configuration.api.Configuration)1 ConfigurationLoader (com.buschmais.jqassistant.core.configuration.api.ConfigurationLoader)1 ConfigurationLoaderImpl (com.buschmais.jqassistant.core.configuration.impl.ConfigurationLoaderImpl)1 PluginRepository (com.buschmais.jqassistant.core.plugin.api.PluginRepository)1 RuleConfiguration (com.buschmais.jqassistant.core.rule.api.reader.RuleConfiguration)1 StoreConfiguration (com.buschmais.jqassistant.core.store.api.StoreConfiguration)1 EmbeddedNeo4jConfiguration (com.buschmais.jqassistant.neo4j.backend.bootstrap.EmbeddedNeo4jConfiguration)1 File (java.io.File)1