1/*2 * $Id: GenerateVelocityMojo.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.Map;
4041import org.apache.maven.plugins.annotations.LifecyclePhase;
42import org.apache.maven.plugins.annotations.Mojo;
43import org.apache.maven.plugins.annotations.Parameter;
44import org.apache.maven.plugins.annotations.ResolutionScope;
45import org.apache.tiles.autotag.generate.TemplateGeneratorBuilder;
46import org.apache.tiles.autotag.generate.TemplateGeneratorFactory;
47import org.apache.tiles.autotag.velocity.VelocityTemplateGeneratorFactory;
48import org.apache.velocity.app.VelocityEngine;
495051/**52 * Generates Velocity code.53 */54 @Mojo(
55 name = "generate-velocity",
56 defaultPhase = LifecyclePhase.GENERATE_SOURCES,
57 requiresDependencyResolution = ResolutionScope.COMPILE)
58publicclassGenerateVelocityMojoextendsAbstractGenerateMojo {
5960/**61 * Name of the Runtime.62 */63 @Parameter(defaultValue = "org.apache.tiles.autotag.velocity.runtime.Runtime", required = true)
64 String velocityRuntime;
6566/** {@inheritDoc} */67 @Override
68protected Map<String, String> getParameters() {
69returnnull;
70 }
7172/** {@inheritDoc} */73 @Override
74protected String getRuntimeClass() {
75return velocityRuntime;
76 }
7778 @Override
79protectedTemplateGeneratorFactory createTemplateGeneratorFactory(
80 VelocityEngine velocityEngine) {
81returnnewVelocityTemplateGeneratorFactory(classesOutputLocator,
82 resourcesOutputLocator, velocityEngine,
83 TemplateGeneratorBuilder.createNewInstance());
84 }
85 }