Search in sources :

Example 11 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project intellij-plugins by JetBrains.

the class AdditionalSourceRootUtil method collectGeneratedSource.

private static void collectGeneratedSource(PlexusConfiguration parentConfiguration, String parameterName, MavenProject project, PluginParameterExpressionEvaluator expressionEvaluator, Logger logger) {
    final PlexusConfiguration configuration = parentConfiguration.getChild(parameterName);
    if (configuration == null) {
        return;
    }
    String filepath = configuration.getValue();
    if (filepath == null) {
        final String defaultValue = configuration.getAttribute("default-value");
        if (defaultValue == null) {
            return;
        }
        filepath = (String) evaluate(expressionEvaluator, defaultValue, logger);
    }
    if (filepath != null) {
        addFile(filepath, project, expressionEvaluator);
    }
}
Also used : PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration)

Example 12 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project intellij-plugins by JetBrains.

the class AdditionalSourceRootUtil method addByGeneratorMojo.

public static void addByGeneratorMojo(MojoExecution mojoExecution, MavenSession session, MavenProject project, Logger logger) {
    final PluginParameterExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
    final PlexusConfiguration configuration = new XmlPlexusConfiguration(mojoExecution.getConfiguration());
    for (String parameterName : new String[] { "baseOutputDirectory", "outputDirectory" }) {
        collectGeneratedSource(configuration, parameterName, project, expressionEvaluator, logger);
    }
}
Also used : PluginParameterExpressionEvaluator(org.apache.maven.plugin.PluginParameterExpressionEvaluator) PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration) XmlPlexusConfiguration(org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration)

Example 13 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project randomizedtesting by randomizedtesting.

the class JUnit4Mojo method populateJUnitElement.

/**
   * Populate junit4 task with attributes and values.
   */
private void populateJUnitElement(Element junit4) {
    // Attributes.
    if (dir != null)
        junit4.addAttribute("dir", dir.getAbsolutePath());
    if (tempDir != null)
        junit4.addAttribute("tempDir", tempDir.getAbsolutePath());
    if (parallelism != null)
        junit4.addAttribute("parallelism", parallelism);
    if (failureProperty != null)
        junit4.addAttribute("failureProperty", failureProperty);
    if (seed != null)
        junit4.addAttribute("seed", seed);
    if (jvm != null)
        junit4.addAttribute("jvm", jvm);
    if (maxMemory != null)
        junit4.addAttribute("maxMemory", maxMemory);
    if (jvmOutputAction != null)
        junit4.addAttribute("jvmOutputAction", jvmOutputAction);
    if (heartbeat != 0)
        junit4.addAttribute("heartbeat", Long.toString(heartbeat));
    if (prefix != null)
        junit4.addAttribute("prefix", prefix);
    if (debugStream != null)
        junit4.addAttribute("debugStream", debugStream.toString());
    if (newEnvironment != null)
        junit4.addAttribute("newEnvironment", newEnvironment.toString());
    if (ifNoTests != null)
        junit4.addAttribute("ifNoTests", ifNoTests);
    if (statsPropertyPrefix != null)
        junit4.addAttribute("statsPropertyPrefix", statsPropertyPrefix);
    if (onNonEmptyWorkDirectory != null)
        junit4.addAttribute("onNonEmptyWorkDirectory", onNonEmptyWorkDirectory);
    junit4.addAttribute("shuffleOnSlave", Boolean.toString(shuffleOnSlave));
    junit4.addAttribute("printSummary", Boolean.toString(printSummary));
    junit4.addAttribute("isolateWorkingDirectories", Boolean.toString(isolateWorkingDirectories));
    junit4.addAttribute("haltOnFailure", Boolean.toString(haltOnFailure));
    junit4.addAttribute("leaveTemporary", Boolean.toString(leaveTemporary));
    junit4.addAttribute("dynamicAssignmentRatio", Float.toString(dynamicAssignmentRatio));
    junit4.addAttribute("sysouts", Boolean.toString(sysouts));
    junit4.addAttribute("uniqueSuiteNames", Boolean.toString(uniqueSuiteNames));
    // JVM args.
    for (String jvmArg : firstNonNull(jvmArgs, EMPTY_STRING_ARRAY)) {
        junit4.addElement("jvmarg").addAttribute("value", jvmArg);
    }
    if (argLine != null) {
        junit4.addElement("jvmarg").addAttribute("line", argLine);
    }
    // System properties
    for (Map.Entry<String, String> e : firstNonNull(systemProperties, EMPTY_STRING_STRING_MAP).entrySet()) {
        Element sysproperty = junit4.addElement("sysproperty");
        sysproperty.addAttribute("key", Strings.nullToEmpty(e.getKey()));
        sysproperty.addAttribute("value", Strings.nullToEmpty(e.getValue()));
    }
    // Environment variables.
    for (Map.Entry<String, String> e : firstNonNull(environmentVariables, EMPTY_STRING_STRING_MAP).entrySet()) {
        Element sysproperty = junit4.addElement("env");
        sysproperty.addAttribute("key", Strings.nullToEmpty(e.getKey()));
        sysproperty.addAttribute("value", Strings.nullToEmpty(e.getValue()));
    }
    // Tests input.
    setupTestInput(junit4);
    // Tests classpath
    setupTestClasspath(junit4);
    // Copy over listeners configuration.
    if (listeners != null) {
        appendRawXml(listeners, junit4);
    } else {
        // Add a console listener and a surefire-like XML listener.
        Element listenersElement = junit4.addElement("listeners");
        Element surefireReport = listenersElement.addElement("report-ant-xml");
        surefireReport.addAttribute("dir", surefireReportsDirectory.getAbsolutePath());
        surefireReport.addAttribute("mavenExtensions", "true");
        Element consoleReport = listenersElement.addElement("report-text");
        consoleReport.addAttribute("showThrowable", "true");
        consoleReport.addAttribute("showStackTraces", "true");
        consoleReport.addAttribute("showOutput", "never");
        consoleReport.addAttribute("showStatusOk", "false");
        consoleReport.addAttribute("showStatusError", "true");
        consoleReport.addAttribute("showStatusFailure", "true");
        consoleReport.addAttribute("showStatusIgnored", "false");
        consoleReport.addAttribute("showSuiteSummary", "true");
    }
    // Copy over assertions
    appendRawXml(assertions, junit4);
    // Copy over balancers
    appendRawXml(balancers, junit4);
    // Copy over verbatim section.
    if (verbatim != null) {
        for (PlexusConfiguration c : verbatim.getChildren()) {
            appendRawXml(c, junit4);
        }
    }
}
Also used : PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration) Element(org.dom4j.Element) Map(java.util.Map)

Example 14 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project liquibase by liquibase.

the class LiquibaseDropAllMojoTest method createDropAllMojo.

/*-------------------------------------------------------------------------*\
	 * PRIVATE METHODS
	\*-------------------------------------------------------------------------*/
private LiquibaseDropAll createDropAllMojo() throws Exception {
    LiquibaseDropAll mojo = new LiquibaseDropAll();
    PlexusConfiguration config = loadConfiguration(CONFIG_FILE);
    configureMojo(mojo, config);
    return mojo;
}
Also used : PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration)

Example 15 with PlexusConfiguration

use of org.codehaus.plexus.configuration.PlexusConfiguration in project liquibase by liquibase.

the class LiquibaseRollbackMojoTest method createUpdateMojo.

/*-------------------------------------------------------------------------*\
   * PRIVATE METHODS
  \*-------------------------------------------------------------------------*/
private LiquibaseRollback createUpdateMojo(String configFileName) throws Exception {
    LiquibaseRollback mojo = new LiquibaseRollback();
    PlexusConfiguration config = loadConfiguration(configFileName);
    configureMojo(mojo, config);
    return mojo;
}
Also used : PlexusConfiguration(org.codehaus.plexus.configuration.PlexusConfiguration)

Aggregations

PlexusConfiguration (org.codehaus.plexus.configuration.PlexusConfiguration)19 ArrayList (java.util.ArrayList)5 XmlPlexusConfiguration (org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration)5 Map (java.util.Map)2 PluginParameterExpressionEvaluator (org.apache.maven.plugin.PluginParameterExpressionEvaluator)2 InterpolationException (org.codehaus.plexus.interpolation.InterpolationException)2 MapBasedValueSource (org.codehaus.plexus.interpolation.MapBasedValueSource)2 StringSearchInterpolator (org.codehaus.plexus.interpolation.StringSearchInterpolator)2 ValueSource (org.codehaus.plexus.interpolation.ValueSource)2 CheckstyleException (com.puppycrawl.tools.checkstyle.api.CheckstyleException)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 IOException (java.io.IOException)1 Reader (java.io.Reader)1 HashMap (java.util.HashMap)1 List (java.util.List)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 CheckstyleExecutorException (org.apache.maven.plugins.checkstyle.exec.CheckstyleExecutorException)1 CheckstyleExecutorRequest (org.apache.maven.plugins.checkstyle.exec.CheckstyleExecutorRequest)1