Code example for PrintWriter

Methods: close, println

0
	 
	public static void init() throws Exception { 
		if (!inited) {
			File pluginStateLoc = GettingStartedTestActivator.getDefault().getStateLocation().toFile();
			File settings = new File(pluginStateLoc, "settings.xml");
			PrintWriter out = new PrintWriter(new FileWriter(settings));
			try { 
				File localRepoLocation = new File(pluginStateLoc, "m2-repo");
				out.println("<settings>\n" + 
						"  <localRepository>"+ localRepoLocation +"</localRepository>\n" + 
						"</settings>");  
				System.out.println("Telling m2e to put local maven cache at:");
				System.out.println(localRepoLocation);
			} finally { 
				out.close();
			} 
			 
			 
			IMavenConfiguration mavenConf = MavenPlugin.getMavenConfiguration();
			mavenConf.setUserSettingsFile(settings.getAbsolutePath());
			inited = true;