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/.
If you want to contribute to the Java analyzer, please refer to the Contributing Guide.
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
.
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
.
To run the unit tests:
./gradlew test
To run the smoke tests using Docker:
bin/run-tests-in-docker.sh