private void appendExcludesListToExcludesFile ( Plugin plugin , List < String > nonAffectedClasses ) throws MojoExecutionException { String excludesFileName = extractParamValue ( plugin , EXCLUDES_FILE_PARAM_NAME ) ; File excludesFileFile = new File ( excludesFileName ) ; // First restore file in case it has been modified by this // plugin before (if 'restore' was not run, or VM crashed). restoreExcludesFile ( plugin ) ; PrintWriter pw = null ; try { // Have to restore original file (on shutdown); see // RestoreMojo. pw = new PrintWriter ( new FileOutputStream ( excludesFileFile , true ) , true ) ; pw . println ( EKSTAZI_LINE_MARKER ) ; for ( String exclude : nonAffectedClasses ) { pw . println ( exclude ) ; } // If "exclude(s)" is not present, we also have to add default value to exclude inner classes. if ( ! isAtLeastOneExcludePresent ( plugin ) ) { pw . println ( "**/*$*" ) ; } } catch ( IOException ex ) { throw new MojoExecutionException ( "Could not access excludesFile" , ex ) ; } finally { if ( pw != null ) { pw . close ( ) ; } } }
Appends list of classes that should be excluded to the given file .