1/*2 * $Id: GenerateFreemarkerMojo.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;
2223import java.util.Map;
2425import org.apache.maven.plugins.annotations.LifecyclePhase;
26import org.apache.maven.plugins.annotations.Mojo;
27import org.apache.maven.plugins.annotations.Parameter;
28import org.apache.maven.plugins.annotations.ResolutionScope;
29import org.apache.tiles.autotag.freemarker.FMTemplateGeneratorFactory;
30import org.apache.tiles.autotag.generate.TemplateGeneratorBuilder;
31import org.apache.tiles.autotag.generate.TemplateGeneratorFactory;
32import org.apache.velocity.app.VelocityEngine;
3334/**35 * Generates Freemarker code.36 */37 @Mojo(
38 name = "generate-freemarker",
39 defaultPhase = LifecyclePhase.GENERATE_SOURCES,
40 requiresDependencyResolution = ResolutionScope.COMPILE)
41publicclassGenerateFreemarkerMojoextendsAbstractGenerateMojo {
4243/**44 * Name of the Runtime.45 */46 @Parameter(defaultValue = "org.apache.tiles.autotag.freemarker.runtime.Runtime", required = true)
47 String freemarkerRuntime;
4849/** {@inheritDoc} */50 @Override
51protected Map<String, String> getParameters() {
52returnnull;
53 }
5455/** {@inheritDoc} */56 @Override
57protected String getRuntimeClass() {
58return freemarkerRuntime;
59 }
6061 @Override
62protectedTemplateGeneratorFactory createTemplateGeneratorFactory(
63 VelocityEngine velocityEngine) {
64returnnewFMTemplateGeneratorFactory(classesOutputLocator,
65 velocityEngine, TemplateGeneratorBuilder.createNewInstance());
66 }
67 }