public void run() throws DITAOTException {
        if (!args.containsKey("args.input")) {
            throw new IllegalStateException("Input file not set");
        }
        if (!args.containsKey("output.dir")) {
            throw new IllegalStateException("Output directory not set");
        }
        final File tempDir = getTempDir();
        args.put("dita.temp.dir", tempDir.getAbsolutePath());
        boolean cleanTemp = true;

        final ch.qos.logback.classic.Logger debugLogger = createDebugLog ? openDebugLogger(tempDir) : null;

        try {
            final File buildFile = new File(ditaDir, "build.xml");
            final Project project = new Project();
            project.setCoreLoader(this.getClass().getClassLoader());

            if (logger != null) {
                project.addBuildListener(new LoggerListener(logger));
            }
            if (debugLogger != null) {
                project.addBuildListener(new LoggerListener(debugLogger));
            }

            project.fireBuildStarted();
            project.init();
            project.setBaseDir(ditaDir);
            project.setKeepGoingMode(false);
            for (final Map.Entry<String, String> arg : args.entrySet()) {
                project.setUserProperty(arg.getKey(), arg.getValue());
            }
            ProjectHelper.configureProject(project, buildFile);
            final Vector<String> targets = new Vector<>();
//            targets.addElement(project.getDefaultTarget());
            targets.addElement("dita2" + args.get("transtype"));
            project.executeTargets(targets);
        } catch (final BuildException e) {
            cleanTemp = cleanOnFailure;
            throw new DITAOTException(e);
        } finally {
            if (debugLogger != null) {
                closeDebugLogger(debugLogger);
            }
            if (cleanTemp) {
                try {
                    FileUtils.forceDelete(tempDir);
                } catch (final IOException ex) {
                    logger.error("Failed to delete temporary directory " + tempDir);
                }
            }
        }
    }
public void run ( ) throws DITAOTException { if ( ! args . containsKey ( "args.input" ) ) { throw new IllegalStateException ( "Input file not set" ) ; } if ( ! args . containsKey ( "output.dir" ) ) { throw new IllegalStateException ( "Output directory not set" ) ; } final File tempDir = getTempDir ( ) ; args . put ( "dita.temp.dir" , tempDir . getAbsolutePath ( ) ) ; boolean cleanTemp = true ; final ch . qos . logback . classic . Logger debugLogger = createDebugLog ? openDebugLogger ( tempDir ) : null ; try { final File buildFile = new File ( ditaDir , "build.xml" ) ; final Project project = new Project ( ) ; project . setCoreLoader ( this . getClass ( ) . getClassLoader ( ) ) ; if ( logger != null ) { project . addBuildListener ( new LoggerListener ( logger ) ) ; } if ( debugLogger != null ) { project . addBuildListener ( new LoggerListener ( debugLogger ) ) ; } project . fireBuildStarted ( ) ; project . init ( ) ; project . setBaseDir ( ditaDir ) ; project . setKeepGoingMode ( false ) ; for ( final Map . Entry < String , String > arg : args . entrySet ( ) ) { project . setUserProperty ( arg . getKey ( ) , arg . getValue ( ) ) ; } ProjectHelper . configureProject ( project , buildFile ) ; final Vector < String > targets = new Vector < > ( ) ; targets . addElement ( "dita2" + args . get ( "transtype" ) ) ; project . executeTargets ( targets ) ; } catch ( final BuildException e ) { cleanTemp = cleanOnFailure ; throw new DITAOTException ( e ) ; } finally { if ( debugLogger != null ) { closeDebugLogger ( debugLogger ) ; } if ( cleanTemp ) { try { FileUtils . forceDelete ( tempDir ) ; } catch ( final IOException ex ) { logger . error ( "Failed to delete temporary directory " + tempDir ) ; } } } }
Run process

@throws DITAOTException if processing failed