1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.tiles.autotag.plugin;
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 import java.util.HashMap;
40 import java.util.Map;
41
42 import org.apache.maven.plugins.annotations.LifecyclePhase;
43 import org.apache.maven.plugins.annotations.Mojo;
44 import org.apache.maven.plugins.annotations.Parameter;
45 import org.apache.maven.plugins.annotations.ResolutionScope;
46 import org.apache.tiles.autotag.generate.TemplateGeneratorBuilder;
47 import org.apache.tiles.autotag.generate.TemplateGeneratorFactory;
48 import org.apache.tiles.autotag.jsp.JspTemplateGeneratorFactory;
49 import org.apache.velocity.app.VelocityEngine;
50
51
52
53
54
55 @Mojo(
56 name = "generate-jsp",
57 defaultPhase = LifecyclePhase.GENERATE_SOURCES,
58 requiresDependencyResolution = ResolutionScope.COMPILE)
59 public class GenerateJspMojo extends AbstractGenerateMojo {
60
61
62
63
64 @Parameter(required = true)
65 String taglibURI;
66
67
68
69
70 @Parameter(defaultValue = "org.apache.tiles.autotag.jsp.runtime.Runtime", required = true)
71 String jspRuntime;
72
73
74 @Override
75 protected Map<String, String> getParameters() {
76 Map<String, String> params = new HashMap<String, String>();
77 params.put("taglibURI", taglibURI);
78 return params;
79 }
80
81
82 @Override
83 protected String getRuntimeClass() {
84 return jspRuntime;
85 }
86
87 @Override
88 protected TemplateGeneratorFactory createTemplateGeneratorFactory(
89 VelocityEngine velocityEngine) {
90 return new JspTemplateGeneratorFactory(classesOutputLocator,
91 resourcesOutputLocator, velocityEngine,
92 TemplateGeneratorBuilder.createNewInstance());
93 }
94 }