1/*2 * $Id: GenerateJspMojo.java 1643653 2014-12-07 06:47:59Z nlebas $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.autotag.plugin;
2223/*24 * Copyright 2001-2005 The Apache Software Foundation.25 *26 * Licensed under the Apache License, Version 2.0 (the "License");27 * you may not use this file except in compliance with the License.28 * You may obtain a copy of the License at29 *30 * http://www.apache.org/licenses/LICENSE-2.031 *32 * Unless required by applicable law or agreed to in writing, software33 * distributed under the License is distributed on an "AS IS" BASIS,34 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.35 * See the License for the specific language governing permissions and36 * limitations under the License.37 */3839import java.util.HashMap;
40import java.util.Map;
4142import org.apache.maven.plugins.annotations.LifecyclePhase;
43import org.apache.maven.plugins.annotations.Mojo;
44import org.apache.maven.plugins.annotations.Parameter;
45import org.apache.maven.plugins.annotations.ResolutionScope;
46import org.apache.tiles.autotag.generate.TemplateGeneratorBuilder;
47import org.apache.tiles.autotag.generate.TemplateGeneratorFactory;
48import org.apache.tiles.autotag.jsp.JspTemplateGeneratorFactory;
49import org.apache.velocity.app.VelocityEngine;
505152/**53 * Goal which touches a timestamp file.54 */55 @Mojo(
56 name = "generate-jsp",
57 defaultPhase = LifecyclePhase.GENERATE_SOURCES,
58 requiresDependencyResolution = ResolutionScope.COMPILE)
59publicclassGenerateJspMojoextendsAbstractGenerateMojo {
6061/**62 * URI of the tag library.63 */64 @Parameter(required = true)
65 String taglibURI;
6667/**68 * Name of the Runtime.69 */70 @Parameter(defaultValue = "org.apache.tiles.autotag.jsp.runtime.Runtime", required = true)
71 String jspRuntime;
7273/** {@inheritDoc} */74 @Override
75protected Map<String, String> getParameters() {
76 Map<String, String> params = new HashMap<String, String>();
77 params.put("taglibURI", taglibURI);
78return params;
79 }
8081/** {@inheritDoc} */82 @Override
83protected String getRuntimeClass() {
84return jspRuntime;
85 }
8687 @Override
88protectedTemplateGeneratorFactory createTemplateGeneratorFactory(
89 VelocityEngine velocityEngine) {
90returnnewJspTemplateGeneratorFactory(classesOutputLocator,
91 resourcesOutputLocator, velocityEngine,
92 TemplateGeneratorBuilder.createNewInstance());
93 }
94 }