diff -r 57fc3a0563c9 -r 0236ad6ab4d2 mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java --- a/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java Tue Dec 25 15:08:39 2012 +0100 +++ b/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrswrMojo.java Wed Jan 09 20:55:26 2013 +0100 @@ -44,6 +44,9 @@ /** Resource to show as initial page */ @Parameter private String startpage; + + @Parameter + private String startpackage; @Parameter(defaultValue="${project}") private MavenProject prj; @@ -63,9 +66,9 @@ Closeable httpServer; try { - httpServer = Launcher.showURL(url, startpage); + httpServer = Launcher.showURL(url, startpage()); } catch (Exception ex) { - throw new MojoExecutionException("Can't open " + startpage, ex); + throw new MojoExecutionException("Can't open " + startpage(), ex); } System.in.read(); httpServer.close(); @@ -73,34 +76,12 @@ throw new MojoExecutionException("Can't show the browser", ex); } } - - private static File findNonEmptyFolder(File dir) throws MojoExecutionException { - if (!dir.isDirectory()) { - throw new MojoExecutionException("Not a directory " + dir); - } - File[] arr = dir.listFiles(); - if (arr.length == 1 && arr[0].isDirectory()) { - return findNonEmptyFolder(arr[0]); - } - return dir; - } - - private static long collectAllClasses(String prefix, File toCheck, List arr) { - File[] files = toCheck.listFiles(); - if (files != null) { - long newest = 0L; - for (File f : files) { - long lastModified = collectAllClasses(prefix + f.getName() + "/", f, arr); - if (newest < lastModified) { - newest = lastModified; - } - } - return newest; - } else if (toCheck.getName().endsWith(".class")) { - arr.add(prefix.substring(0, prefix.length() - 7)); - return toCheck.lastModified(); + + private String startpage() { + if (startpackage == null) { + return startpage; } else { - return 0L; + return startpackage.replace('.', '/') + '/' + startpage; } }