com.gitee.l0km.codegen.base.plugin.BasePlugin Maven / Gradle / Ivy
package com.gitee.l0km.codegen.base.plugin;
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.Parameter;
import com.gitee.l0km.codegen.base.generator.GeneratorConfiguration;
/**
* codegen插件抽象类
* @author guyadong
*
*/
public abstract class BasePlugin extends AbstractMojo {
/**
* template root path
*/
@Parameter(defaultValue = GeneratorConfiguration.DEFAULT_ROOT )
private String templateRoot="";
/**
* Output file location
*/
@Parameter(defaultValue = "${project.build.directory}/generated-sources")
private String outputDir;
/**
* templates included folder path under template-root
*/
@Parameter(defaultValue = GeneratorConfiguration.DEFAULT_INCLUDE)
private String include;
/**
* Resource loader type: [class,file],default class
*/
@Parameter(defaultValue = GeneratorConfiguration.DEFAULT_LOADER)
private String loader;
public BasePlugin() {
}
/**
* template used folder path under template-root
*/
protected abstract String getTemplateFolder();
protected List makeArgs(){
ArrayList args = new ArrayList(5);
args.add("--" + GeneratorConfiguration.TEMPLATE_ROOT_OPTION_LONG);
args.add(this.templateRoot);
args.add("--" + GeneratorConfiguration.TEMPLATE_FOLDER_OPTION_LONG);
args.add(getTemplateFolder());
args.add("--" + GeneratorConfiguration.TEMPLATE_INCLUDE_OPTION_LONG);
args.add(this.include);
args.add("--" + GeneratorConfiguration.OUTPUT_LOCATION_OPTION_LONG);
args.add(this.outputDir);
args.add("--" + GeneratorConfiguration.RESOURCE_LOADER_OPTION_LONG);
args.add(this.loader);
return args;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy