use of org.apache.cayenne.dbsync.reverse.configuration.ToolsModule in project cayenne by apache.
the class DbImporterMojo method execute.
public void execute() throws MojoExecutionException, MojoFailureException {
Logger logger = new MavenLogger(this);
// check missing data source parameters
dataSource.validate();
DbImportConfiguration config = createConfig(logger);
Injector injector = DIBootstrap.createInjector(new DbSyncModule(), new ToolsModule(logger), new DbImportModule());
DbImportConfigurationValidator validator = new DbImportConfigurationValidator(dbImportConfig, config, injector);
try {
validator.validate();
} catch (Exception ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
try {
injector.getInstance(DbImportAction.class).execute(config);
} catch (Exception ex) {
Throwable th = Util.unwindException(ex);
String message = "Error importing database schema";
if (th.getLocalizedMessage() != null) {
message += ": " + th.getLocalizedMessage();
}
getLog().error(message);
throw new MojoExecutionException(message, th);
}
}
Aggregations