use of org.mybatis.generator.config.xml.ConfigurationParser in project generator by mybatis.
the class MyBatisGeneratorTest method testGenerateIbatis2WithInvalidConfig.
@Test(expected = InvalidConfigurationException.class)
public void testGenerateIbatis2WithInvalidConfig() throws Exception {
List<String> warnings = new ArrayList<String>();
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(this.getClass().getClassLoader().getResourceAsStream("generatorConfigIbatis2_badConfig.xml"));
DefaultShellCallback shellCallback = new DefaultShellCallback(true);
try {
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
myBatisGenerator.generate(null, null, null, false);
} catch (InvalidConfigurationException e) {
assertEquals(1, e.getErrors().size());
throw e;
}
}
use of org.mybatis.generator.config.xml.ConfigurationParser in project MyProject by fuyuanshun.
the class GeneratorSqlmap method generator.
public void generator() throws Exception {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
// 指定 逆向工程配置文件
File configFile = new File("generatorConfig.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
}
use of org.mybatis.generator.config.xml.ConfigurationParser in project jeesuite-libs by vakinge.
the class MyBatisGeneratorTool method main.
public static void main(String[] args) {
List<String> warnings = new ArrayList<String>();
String path = Thread.currentThread().getContextClassLoader().getResource("").getPath();
boolean overwrite = true;
File configFile = new File(path + "/../../src/test/resources/generator/generatorConfig.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = null;
try {
config = cp.parseConfiguration(configFile);
} catch (IOException e) {
e.printStackTrace();
} catch (XMLParserException e) {
e.printStackTrace();
}
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = null;
try {
myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
} catch (InvalidConfigurationException e) {
e.printStackTrace();
}
try {
myBatisGenerator.generate(null);
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
use of org.mybatis.generator.config.xml.ConfigurationParser in project spring-boot-api-seed-project by selfassu.
the class CodeGenerator method generator.
private void generator() throws Exception {
List<String> warnings = new ArrayList<String>();
System.out.println("====开始读取配置文件======");
File configFile = new File(CONFIG_PATH);
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(true);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
}
use of org.mybatis.generator.config.xml.ConfigurationParser in project dubidubi by lzzzz4.
the class Start method generator.
public void generator() throws Exception {
List<String> warnings = new ArrayList<>();
boolean overwrite = true;
// 指定 逆向工程配置文件
// File configFile = new File("generatorConfig.xml");
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("generatorConfig.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(inputStream);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
}
Aggregations