private void cscCommand ( ) throws MojoExecutionException { generateAssemblyInfo ( ) ; String cscPath = findCscCommand ( ) ; List < String > commandList = new LinkedList < String > ( cspath ) ; commandList . add ( 0 , cscPath ) ; commandList . add ( 1 , "/target:library" ) ; commandList . add ( 2 , "/out:" + namespace + ".dll" ) ; if ( isLinux ( ) ) { commandList . add ( 3 , "/reference:System.Web.Services" ) ; } String [ ] command = commandList . toArray ( new String [ commandList . size ( ) ] ) ; ProcessBuilder builder = new ProcessBuilder ( ) ; builder . redirectErrorStream ( true ) ; builder . directory ( outputDirectory ) ; builder . command ( command ) ; try { executeACommand ( builder . start ( ) ) ; } catch ( InterruptedException | IOException e ) { throw new MojoExecutionException ( "Error, while executing command: " + Arrays . toString ( command ) + "\n" , e ) ; } }
Search for the csc command and execute it when it is found