Skip to content

exercism/java-analyzer

Repository files navigation

Java Analyzer Coverage Status

The Java analyzer uses Abstract Syntax Trees (ASTs) to analyze submitted solutions using the javaparser library.

The documentation for this project can be found at exercism.github.io/java-analyzer/.

Contributing

If you want to contribute to the Java analyzer, please refer to the Contributing Guide.

Usage

Running directly

Start by building the JAR using Gradle:

./gradlew build

Then, run the Java analyzer using build/libs/java-analyzer.jar. For example, to analyze a solution for the leap exercise, run:

java -jar build/libs/java-analyzer.jar leap /path/to/leap /path/to/output/folder

The analyzer output is written to analysis.json and tags.json in /path/to/output/folder.

Running with Docker

To run the Java analyzer using Docker, first build and tag the Docker image:

docker build -t exercism/java-analyzer .

Then, run the image and mount the directory of the solution to analyze. For example, to analyze a solution for the leap exercise located at ~/exercism/java/leap, run:

docker run -v /path/to/leap:/input -v /path/to/output/folder:/output exercism/java-analyzer leap /input /output

The analyzer output is written to analysis.json and tags.json in /path/to/output/folder.

Tests

Unit tests

To run the unit tests:

./gradlew test

Smoke tests

To run the smoke tests using Docker:

bin/run-tests-in-docker.sh