diff --git a/cli/src/main/java/de/jplag/cli/JPlagRunner.java b/cli/src/main/java/de/jplag/cli/JPlagRunner.java index 3346eec62..3dc3b8484 100644 --- a/cli/src/main/java/de/jplag/cli/JPlagRunner.java +++ b/cli/src/main/java/de/jplag/cli/JPlagRunner.java @@ -40,6 +40,10 @@ public static JPlagResult runJPlag(JPlagOptions options) throws ExitException { * @throws IOException If the internal server throws an exception */ public static void runInternalServer(File zipFile, int port) throws IOException { + if (!ReportViewer.hasCompiledViewer()) { + logger.warn("The report viewer is not available. Check whether you compiled JPlag with the report viewer."); + return; + } ReportViewer reportViewer = new ReportViewer(zipFile, port); int actualPort = reportViewer.start(); logger.info("ReportViewer started on port http://localhost:{}", actualPort); diff --git a/cli/src/main/java/de/jplag/cli/server/ReportViewer.java b/cli/src/main/java/de/jplag/cli/server/ReportViewer.java index 2f5b83cbd..7f4e5c471 100644 --- a/cli/src/main/java/de/jplag/cli/server/ReportViewer.java +++ b/cli/src/main/java/de/jplag/cli/server/ReportViewer.java @@ -138,4 +138,8 @@ public void handle(HttpExchange exchange) throws IOException { RoutingTree getRoutingTree() { return routingTree; } + + public static boolean hasCompiledViewer() { + return ResponseData.fromResourceUrl("/" + REPORT_VIEWER_RESOURCE_PREFIX + "/index.html") != null; + } }