Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning when report viewer not included #2172

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/src/main/java/de/jplag/cli/JPlagRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.info("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);
Expand Down
4 changes: 4 additions & 0 deletions cli/src/main/java/de/jplag/cli/server/ReportViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Loading