Search in sources :

Example 1 with DefaultAutoGenerator

use of com.github.mengweijin.generator.DefaultAutoGenerator in project code-generator-maven-plugin by mengweijin.

the class AbstractGeneratorMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    try {
        // clean TMP folder
        FileUtil.del(FileUtil.file(ProjectInfo.TMP_DIR));
        this.loadParentProjectClassToJarClassLoader();
        TemplateUtils.copyTemplateFolderToJavaTmp("templates/");
        this.parameters = Optional.ofNullable(this.parameters).orElse(new Parameters());
        this.setDefaultFixedParameters(this.parameters);
        ProjectInfo projectInfo = new ProjectInfo();
        projectInfo.setParameters(this.parameters);
        projectInfo.setResourceList(this.getResources());
        projectInfo.setBaseDir(this.baseDir);
        projectInfo.setSourceDir(this.sourceDir);
        new DefaultAutoGenerator(projectInfo).execute();
    } catch (Exception e) {
        getLog().error(e);
        throw new RuntimeException(e);
    }
}
Also used : Parameters(com.github.mengweijin.generator.entity.Parameters) ProjectInfo(com.github.mengweijin.generator.entity.ProjectInfo) DefaultAutoGenerator(com.github.mengweijin.generator.DefaultAutoGenerator) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Aggregations

DefaultAutoGenerator (com.github.mengweijin.generator.DefaultAutoGenerator)1 Parameters (com.github.mengweijin.generator.entity.Parameters)1 ProjectInfo (com.github.mengweijin.generator.entity.ProjectInfo)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1