private void removeTaskFromBomFile ( File buildGradleTmp ) { FileReader fileReader ; BufferedReader bufferedReader = null ; try { fileReader = new FileReader ( buildGradleTmp ) ; bufferedReader = new BufferedReader ( fileReader ) ; String currLine ; String originalLines = "" ; while ( ( currLine = bufferedReader . readLine ( ) ) != null ) { if ( currLine . equals ( TASK_COPY_DEPENDENCIES_HEADER ) ) { break ; } else { originalLines = originalLines . concat ( currLine + Constants . NEW_LINE ) ; } } if ( ! originalLines . isEmpty ( ) ) { byte [ ] bytes = originalLines . getBytes ( ) ; Files . write ( Paths . get ( buildGradleTmp . getPath ( ) ) , bytes , StandardOpenOption . WRITE , StandardOpenOption . TRUNCATE_EXISTING ) ; } } catch ( IOException e ) { logger . warn ( "Couldn't remove 'copyDependencies' task from {}, error: {}" , buildGradleTmp . getPath ( ) , e . getMessage ( ) ) ; logger . debug ( "Error: {}" , e . getStackTrace ( ) ) ; } finally { try { if ( bufferedReader != null ) { bufferedReader . close ( ) ; } } catch ( IOException e ) { logger . error ( "Could close the file, cause" , e . getMessage ( ) ) ; } } }
therefore after running the copy - dependencies task removing it from the build . gradle file