1 package org.djunits.cleanup;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.net.URISyntaxException;
6 import java.nio.charset.StandardCharsets;
7 import java.nio.file.Files;
8 import java.nio.file.Paths;
9 import java.util.List;
10
11
12
13
14
15
16
17
18
19
20 public final class CleanClassfileFiles
21 {
22
23 private CleanClassfileFiles()
24 {
25
26 }
27
28
29
30
31
32
33 public static void main(final String[] args) throws IOException, URISyntaxException
34 {
35 File classFolder = new File(CleanClassfileFiles.class.getResource("/").toURI());
36 File workspaceFolder = classFolder.getParentFile().getParentFile().getParentFile();
37 for (File projectFolder : workspaceFolder.listFiles())
38 {
39 if (projectFolder.isDirectory() && projectFolder.getName().startsWith("dju")
40 && new File(projectFolder, ".classpath").exists())
41 {
42 boolean changed = false;
43 File classPathFile = new File(projectFolder, ".classpath");
44 List<String> lines = Files.readAllLines(Paths.get(classPathFile.toURI()), StandardCharsets.UTF_8);
45 for (int index = 0; index < lines.size(); index++)
46 {
47 String line = lines.get(index);
48 if (line.contains("src/main/resources") && line.contains("excluding=\"**\""))
49 {
50 line = line.replace("excluding=\"**\" ", "");
51 lines.set(index, line);
52 changed = true;
53 }
54 }
55 if (changed)
56 {
57 Files.write(Paths.get(classPathFile.toURI()), lines);
58 System.out.println("Changed: " + projectFolder.toString());
59 }
60 }
61 }
62 }
63
64 }