Sha256: 73b90447bd81881323ad13c5f4f935dfeba33f1ff16a9731e344205c036e09e7

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

package org.mortbay.jetty.plugin.beanshell;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

import bsh.Interpreter;
import bsh.EvalError;


import java.util.TreeMap;

/**
 * Used to run scripts in maven
 * Scripts: Beanshell and etc..
 *
 * @author Leopoldo Lee Agdeppa III
 * @goal run
 * @requiresDependencyResolution runtime
 * @execute phase="test-compile"
 * @description Runs jetty6 directly from a maven project
 */
public class BeanShellRunMojo extends AbstractMojo
{

    /**
     * BeanShell Script
     *
     * @parameter
     * @required
     */
    private String script;

    /**
     * Script parameters params.get("param_name");
     *
     * @parameter
     */
    private TreeMap params;


    public void execute() throws MojoExecutionException, MojoFailureException
    {
        Interpreter i = new Interpreter();
        try
        {
            i.set("params", params);
            i.eval(script);
        }
        catch (EvalError evalError)
        {
            evalError.printStackTrace();
            throw new MojoExecutionException(evalError.getMessage());

        }


    }


    public String getScript()
    {
        return script;
    }

    public void setScript(String script)
    {
        this.script = script;
    }

    public TreeMap getParams()
    {
        return params;
    }

    public void setParams(TreeMap params)
    {
        this.params = params;
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
miso-java-0.1.5 jetty/contrib/maven-beanshell-plugin/src/main/java/org/mortbay/jetty/plugin/beanshell/BeanShellRunMojo.java
miso-java-0.1.4 jetty/contrib/maven-beanshell-plugin/src/main/java/org/mortbay/jetty/plugin/beanshell/BeanShellRunMojo.java
miso-java-0.1.3 jetty/contrib/maven-beanshell-plugin/src/main/java/org/mortbay/jetty/plugin/beanshell/BeanShellRunMojo.java
miso-java-0.1.2 jetty/contrib/maven-beanshell-plugin/src/main/java/org/mortbay/jetty/plugin/beanshell/BeanShellRunMojo.java