private File writeVersionInfoTemplateToTempFile ( ) throws MojoExecutionException { try { final File versionInfoSrc = File . createTempFile ( "msbuild-maven-plugin_" + MOJO_NAME , null ) ; InputStream is = getClass ( ) . getResourceAsStream ( DEFAULT_VERSION_INFO_TEMPLATE ) ; FileOutputStream dest = new FileOutputStream ( versionInfoSrc ) ; byte [ ] buffer = new byte [ 1024 ] ; int read = - 1 ; while ( ( read = is . read ( buffer ) ) != - 1 ) { dest . write ( buffer , 0 , read ) ; } dest . close ( ) ; return versionInfoSrc ; } catch ( IOException ioe ) { String msg = "Failed to create temporary version file" ; getLog ( ) . error ( msg , ioe ) ; throw new MojoExecutionException ( msg , ioe ) ; } }
Write the default . rc template file to a temporary file and return it