1.1 --- a/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java Tue Dec 25 15:08:39 2012 +0100
1.2 +++ b/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java Wed Jan 09 20:55:26 2013 +0100
1.3 @@ -44,6 +44,9 @@
1.4 /** Resource to show as initial page */
1.5 @Parameter
1.6 private String startpage;
1.7 +
1.8 + @Parameter
1.9 + private String startpackage;
1.10
1.11 @Parameter(defaultValue="${project}")
1.12 private MavenProject prj;
1.13 @@ -63,9 +66,9 @@
1.14
1.15 Closeable httpServer;
1.16 try {
1.17 - httpServer = Launcher.showURL(url, startpage);
1.18 + httpServer = Launcher.showURL(url, startpage());
1.19 } catch (Exception ex) {
1.20 - throw new MojoExecutionException("Can't open " + startpage, ex);
1.21 + throw new MojoExecutionException("Can't open " + startpage(), ex);
1.22 }
1.23 System.in.read();
1.24 httpServer.close();
1.25 @@ -73,34 +76,12 @@
1.26 throw new MojoExecutionException("Can't show the browser", ex);
1.27 }
1.28 }
1.29 -
1.30 - private static File findNonEmptyFolder(File dir) throws MojoExecutionException {
1.31 - if (!dir.isDirectory()) {
1.32 - throw new MojoExecutionException("Not a directory " + dir);
1.33 - }
1.34 - File[] arr = dir.listFiles();
1.35 - if (arr.length == 1 && arr[0].isDirectory()) {
1.36 - return findNonEmptyFolder(arr[0]);
1.37 - }
1.38 - return dir;
1.39 - }
1.40 -
1.41 - private static long collectAllClasses(String prefix, File toCheck, List<String> arr) {
1.42 - File[] files = toCheck.listFiles();
1.43 - if (files != null) {
1.44 - long newest = 0L;
1.45 - for (File f : files) {
1.46 - long lastModified = collectAllClasses(prefix + f.getName() + "/", f, arr);
1.47 - if (newest < lastModified) {
1.48 - newest = lastModified;
1.49 - }
1.50 - }
1.51 - return newest;
1.52 - } else if (toCheck.getName().endsWith(".class")) {
1.53 - arr.add(prefix.substring(0, prefix.length() - 7));
1.54 - return toCheck.lastModified();
1.55 +
1.56 + private String startpage() {
1.57 + if (startpackage == null) {
1.58 + return startpage;
1.59 } else {
1.60 - return 0L;
1.61 + return startpackage.replace('.', '/') + '/' + startpage;
1.62 }
1.63 }
1.64