Remove the h2 dependency in the com.google.gerrit.pgm.init package
The h2 dependency was only used from "Browser.java" to open a web link
in the browser. We remove this dependency and print a link to the user
so that they open it in their browser of choice.
Release-Notes: skip
Google-Bug-Id: b/216633451
Change-Id: I4c1376fb3fc67ca382d82928caa00555dcddc2fe
diff --git a/java/com/google/gerrit/pgm/init/BUILD b/java/com/google/gerrit/pgm/init/BUILD
index 5849711..0c0d937 100644
--- a/java/com/google/gerrit/pgm/init/BUILD
+++ b/java/com/google/gerrit/pgm/init/BUILD
@@ -23,7 +23,6 @@
"//java/com/google/gerrit/server/schema",
"//java/com/google/gerrit/server/util/time",
"//lib:guava",
- "//lib:h2",
"//lib:jgit",
"//lib/commons:validator",
"//lib/flogger:api",
diff --git a/java/com/google/gerrit/pgm/init/Browser.java b/java/com/google/gerrit/pgm/init/Browser.java
index 2e49e13..228a528 100644
--- a/java/com/google/gerrit/pgm/init/Browser.java
+++ b/java/com/google/gerrit/pgm/init/Browser.java
@@ -24,7 +24,7 @@
import java.net.URISyntaxException;
import org.eclipse.jgit.lib.Config;
-/** Opens the user's web browser to the web UI. */
+/** Points the user to a web browser URL. */
public class Browser {
private final Config cfg;
@@ -57,7 +57,7 @@
return;
}
waitForServer(uri);
- openBrowser(uri, link);
+ printBrowserUrl(uri, link);
}
private void waitForServer(URI uri) throws IOException {
@@ -97,17 +97,9 @@
return url;
}
- private void openBrowser(URI uri, String link) {
+ private void printBrowserUrl(URI uri, String link) {
String url = resolveUrl(uri, link);
- System.err.format("Opening %s ...", url);
+ System.err.format("Please open the following URL in the browser: %s", url);
System.err.flush();
- try {
- org.h2.tools.Server.openBrowser(url);
- System.err.println("OK");
- } catch (Exception e) {
- System.err.println("FAILED");
- System.err.println("Open Gerrit with a JavaScript capable browser:");
- System.err.println(" " + url);
- }
}
}