public ConfigHandler( Object mojo, MavenSession session, MojoExecution execution ) { this.mojo = mojo; if ( session == null ) { throw new IllegalArgumentException( "The argument session is required" ); } if ( execution == null ) { throw new IllegalArgumentException( "The argument execution is required" ); } this.evaluator = new PluginParameterExpressionEvaluator( session, execution ); initConfigPojo(); }
ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, mojoExecution );
private ExpressionEvaluator getExpressionEvaluator(MavenSession session, MojoExecution mojoExecution) { return new PluginParameterExpressionEvaluator( session, mojoExecution ); }
ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator( session, execution );
@MojoProduces private PluginParameterExpressionEvaluator getExpressionEvaluator() { return new PluginParameterExpressionEvaluator(this.session, this.mojoExecution); }
@MojoProduces private PluginParameterExpressionEvaluator getExpressionEvaluator() { return new PluginParameterExpressionEvaluator(this.session, this.mojoExecution); }
@SuppressWarnings("unchecked") protected void populateSystemProperties() throws ExpressionEvaluationException{ PluginParameterExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(session); if(systemProperties!=null){ for(String key: systemProperties.keySet()){ Object val = evaluator.evaluate(systemProperties.get(key)); if(val!=null){ System.setProperty(key, val.toString()); if(getLog().isDebugEnabled()){ getLog().debug("Setting system property "+key+" = "+val); } if("groovity.defaultBinding".equals(key)){ defaultBinding= (Map<String, Object>) new JsonSlurper().parse(new StringReader(val.toString())); } } } } }
protected void init() throws MojoExecutionException { PluginParameterExpressionEvaluator pluginParameterExpressionEvaluator = new PluginParameterExpressionEvaluator( session, mojoExecution); getContext().getBeanFactory().registerResolvableDependency(PluginParameterExpressionEvaluator.class, pluginParameterExpressionEvaluator); try { initializeConfig(); } catch (DependencyResolutionRequiredException e) { throw new MojoExecutionException("Failed to initialize lint-maven-plugin", e); } catch (IOException e) { throw new MojoExecutionException("Failed to initialize lint-maven-plugin", e); } }
@CheckForNull private String getString(MavenProject pom, String parameter) { MavenProject oldProject = session.getCurrentProject(); try { // Switch to the project for which we try to resolve the property. session.setCurrentProject(pom); for (MojoExecution exec : mojoExecutions) { Xpp3Dom configuration = exec.getConfiguration(); PlexusConfiguration pomConfiguration = new XmlPlexusConfiguration(configuration); PlexusConfiguration config = pomConfiguration.getChild(parameter); ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, exec); BasicStringConverter converter = new BasicStringConverter(); String value = converter.fromExpression(config, expressionEvaluator); if (value != null) { return value; } } } catch (Exception e) { log.warn(String.format("Failed to get parameter '%s' for goal '%s': %s", parameter, COMPILE_GOAL, e.getMessage())); } finally { session.setCurrentProject(oldProject); } return null; }
List<String> errors = new ArrayList<String>(); PlexusConfiguration configuration = new XmlPlexusConfiguration(dom); ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(session, execution); for (PlexusConfiguration child : configuration.getChildren()) { String name = fromXML(child.getName());
public MojoInfo(ExecutionEvent event, long startTime) { this(event.getMojoExecution(), null, new XmlPlexusConfiguration( event.getMojoExecution().getConfiguration() ), new PluginParameterExpressionEvaluator( event.getSession(), event.getMojoExecution() ), startTime); }
/** * Returns a mojo configured with the mojo's default configuration. */ // workaround for MPLUGINTESTING-46 - see http://jira.codehaus.org/browse/MPLUGINTESTING-46 protected Mojo lookupMojoWithDefaultConfiguration(MavenProject project, MavenSession session, String goal) throws Exception { MojoExecution mojoExecution = newMojoExecution(goal); Xpp3Dom defaultConfiguration = mojoExecution.getConfiguration(); // the ResolverExpressionEvaluatorStub of lookupMojo is not sufficient to evaluate the variables in the default configuration ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(session, mojoExecution); ComponentConfigurator configurator = getContainer().lookup(ComponentConfigurator.class, "basic"); Mojo mojo = lookupEmptyMojo(goal, project.getFile()); configurator.configureComponent(mojo, new XmlPlexusConfiguration(defaultConfiguration), expressionEvaluator, getContainer().getContainerRealm(), null); return mojo; }
new PluginParameterExpressionEvaluator( session, mojoExecution, pathTranslator, logger, mavenProject, mavenProject.getProperties() );
new PluginParameterExpressionEvaluator( session, mojoExecution, pathTranslator, logger, mavenProject, mavenProject.getProperties() );
Map<String, CDIMojoProcessingStep> processingSteps = getAllProcessingSteps(weldContainer); PluginParameterExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator(this._session, this._mojoExecution); WorkflowExecutor executor = new WorkflowExecutor(getWorkflow(), processingSteps, getLog(), expressionEvaluator);
/** * Gets the helper. * * @param project the project * @param mockExpression the mock expression * @return the helper */ public static EnforcerRuleHelper getHelper( MavenProject project, boolean mockExpression ) { MavenSession session = getMavenSession(); ExpressionEvaluator eval; if ( mockExpression ) { eval = new MockEnforcerExpressionEvaluator( session ); } else { MojoExecution mockExecution = mock( MojoExecution.class ); session.setCurrentProject( project ); eval = new PluginParameterExpressionEvaluator( session, mockExecution ); } return new DefaultEnforcementRuleHelper( session, eval, new SystemStreamLog(), null ); }
@Override public Mojo lookupConfiguredMojo(MavenSession session, MojoExecution execution) throws Exception { MavenProject project = session.getCurrentProject(); MojoDescriptor mojoDescriptor = execution.getMojoDescriptor(); Mojo mojo = container.lookup(Mojo.class, mojoDescriptor.getRoleHint()); ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(session, execution); mojoExecutionConfigurator(execution).configure(project, execution, true); finalizeMojoConfiguration(execution); PlexusConfiguration mojoConfiguration = new XmlPlexusConfiguration(execution.getConfiguration()); String configuratorHint = "basic"; if (mojoDescriptor.getComponentConfigurator() != null) { configuratorHint = mojoDescriptor.getComponentConfigurator(); } ComponentConfigurator configurator = container.lookup(ComponentConfigurator.class, configuratorHint); configurator.configureComponent(mojo, mojoConfiguration, evaluator, container.getContainerRealm()); return mojo; }
ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator( session, execution );
@Override public Mojo lookupConfiguredMojo(MavenSession session, MojoExecution execution) throws Exception { MavenProject project = session.getCurrentProject(); MojoDescriptor mojoDescriptor = execution.getMojoDescriptor(); Mojo mojo = container.lookup(Mojo.class, mojoDescriptor.getRoleHint()); ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(session, execution); Xpp3Dom configuration = null; Plugin plugin = project.getPlugin(mojoDescriptor.getPluginDescriptor().getPluginLookupKey()); if (plugin != null) { configuration = (Xpp3Dom) plugin.getConfiguration(); } if (configuration == null) { configuration = new Xpp3Dom("configuration"); } configuration = Xpp3Dom.mergeXpp3Dom(configuration, execution.getConfiguration()); execution.setConfiguration(configuration); finalizeMojoConfiguration(execution); PlexusConfiguration pluginConfiguration = new XmlPlexusConfiguration(execution.getConfiguration()); String configuratorHint = "basic"; if (mojoDescriptor.getComponentConfigurator() != null) { configuratorHint = mojoDescriptor.getComponentConfigurator(); } ComponentConfigurator configurator = container.lookup(ComponentConfigurator.class, configuratorHint); configurator.configureComponent(mojo, pluginConfiguration, evaluator, container.getContainerRealm()); return mojo; }