private PluginParameterExpressionEvaluator getEvaluator()

in src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java [211:232]


    private PluginParameterExpressionEvaluator getEvaluator() throws MojoFailureException {
        if (evaluator == null) {
            MojoDescriptor mojoDescriptor;
            try {
                mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor("help:evaluate", session, project);
            } catch (Exception e) {
                throw new MojoFailureException("Failure while evaluating.", e);
            }
            MojoExecution mojoExecution = new MojoExecution(mojoDescriptor);

            MavenProject currentProject = session.getCurrentProject();
            // Maven 3: PluginParameterExpressionEvaluator gets the current project from the session:
            // synchronize in case another thread wants to fetch the real current project in between
            synchronized (session) {
                session.setCurrentProject(project);
                evaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
                session.setCurrentProject(currentProject);
            }
        }

        return evaluator;
    }