Class CommandExecutor


  • class CommandExecutor
    extends Object
    Execution of an executable with given arguments in a given working directory logging on log. Sole interface to org.codehaus.plexus.util.cli.
    • Constructor Detail

      • CommandExecutor

        CommandExecutor​(LogWrapper log)
    • Method Detail

      • execute

        String execute​(File workingDir,
                       File pathToExecutable,
                       String command,
                       String[] args,
                       File... resFile)
                throws BuildFailureException
        Logging:
        • EEX01: return code other than 0.
        • EEX02: no target file
        • EEX03: target file not updated
        • WEX04: cannot read target file
        • WEX05: may emit false warnings
        Parameters:
        workingDir - the working directory. The shell changes to that directory before invoking command with arguments args.
        pathToExecutable - the path to the executable command. This may be null if command is on the execution path
        command - the name of the program to be executed
        args - the list of arguments, each containing a blank enclosed in double quotes.
        resFile - result files, i.e. target files which shall be updated bu this command.
        Throws:
        BuildFailureException
      • isUpdatedOrWarn

        private boolean isUpdatedOrWarn​(String command,
                                        File target,
                                        boolean existedBefore,
                                        long lastModifiedBefore)
        Parameters:
        command - the name of the program to be executed Logging:
        • EEX02: no target file
        • EEX03: target file not updated
        • WEX04: cannot read target file
      • execute

        private String execute​(File workingDir,
                               File pathToExecutable,
                               String command,
                               String[] args)
                        throws BuildFailureException
        Execute command with arguments args in the working directory workingDir. Here, pathToExecutable is the path to the executable. May be null?

        Logging: EEX01 for return code other than 0.

        Parameters:
        workingDir - the working directory. The shell changes to that directory before invoking command with arguments args.
        pathToExecutable - the path to the executable command. This may be null if command is on the execution path
        command - the name of the program to be executed
        args - the list of arguments, each containing a blank enclosed in double quotes.
        Throws:
        BuildFailureException - TEX01 if invocation of command fails very basically: