1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.script.beanshell;
20
21 import bsh.EvalError;
22 import bsh.Interpreter;
23 import org.apache.maven.plugin.AbstractMojo;
24 import org.apache.maven.plugin.Mojo;
25 import org.apache.maven.plugin.MojoExecutionException;
26 import org.apache.maven.plugin.MojoFailureException;
27 import org.codehaus.plexus.component.factory.bsh.BshComponent;
28
29
30
31
32
33
34
35 @Deprecated
36 public class BeanshellMojoAdapter extends AbstractMojo implements BshComponent {
37 private Mojo mojo;
38
39 private Interpreter interpreter;
40
41 public BeanshellMojoAdapter(Mojo mojo, Interpreter interpreter) {
42 this.mojo = mojo;
43 this.interpreter = interpreter;
44 }
45
46 public void execute() throws MojoExecutionException, MojoFailureException {
47 try {
48 interpreter.set("logger", getLog());
49
50
51 } catch (EvalError evalError) {
52 throw new MojoExecutionException("Unable to establish mojo", evalError);
53 }
54
55 mojo.execute();
56 }
57
58 public Interpreter getInterpreter() {
59 return interpreter;
60 }
61 }