All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.freegeese.maven.plugin.autocode.AutoCodeMojo Maven / Gradle / Ivy

There is a newer version: 1.1
Show newest version
package com.github.freegeese.maven.plugin.autocode;

import com.github.freegeese.maven.plugin.autocode.configuration.DefaultProperties;
import com.github.freegeese.maven.plugin.autocode.configuration.JdbcConnection;
import com.github.freegeese.maven.plugin.autocode.configuration.ModelType;
import com.github.freegeese.maven.plugin.autocode.configuration.Template;
import com.github.freegeese.maven.plugin.autocode.metadata.Column;
import com.github.freegeese.maven.plugin.autocode.metadata.Table;
import freemarker.template.Configuration;
import freemarker.template.TemplateException;
import ognl.Ognl;
import ognl.OgnlException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Connection;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Mojo(name = "autocode", threadSafe = true)
public class AutoCodeMojo extends AbstractMojo {

    @Parameter(property = "freegeese.autocode.properties")
    private Map properties = new LinkedHashMap<>();

    @Parameter(property = "freegeese.autocode.jdbcConnection")
    private JdbcConnection jdbcConnection;

    @Parameter(property = "freegeese.autocode.tables")
    private List tables;

    @Parameter(property = "freegeese.autocode.templateDirectory")
    private File templateDirectory;

    @Parameter(property = "freegeese.autocode.templates")
    private List