☕Grading with Maven
Overview
This guide shows how to set up a Maven-based Java programming assignment in CodeGrade, using instructor-written JUnit tests and AutoTest for automated grading.
Configuring AutoTest Setup
Install Java and Maven
In AutoTest > Setup:
Add the Install Java block (or use the script below).
Add a Script block to install Java 17, Maven 3.8.4, and
junitparser:
sudo apt update
sudo apt install openjdk-17-jre -y
wget https://archive.apache.org/dist/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz -P /tmp/
sudo tar xf /tmp/apache-maven-3.8.4-bin.tar.gz -C /opt
sudo ln -s /opt/apache-maven-3.8.4/ /opt/maven
sudo rm /usr/bin/mvn
sudo ln -s /opt/maven/bin/mvn /usr/bin/mvn
pip3 install junitparser
Configuring AutoTest Tests
1. Upload and prepare instructor tests
Upload your test files using an Upload Files block (e.g.,
CircleTest.java).Use a Script block to move them:
Block student-submitted test files in General Settings > Hand-in Requirements (e.g., deny *Test.java).

2. Prepare build and classpath
Add a Script block to compile and collect dependencies:
3. Running Maven tests
Use Connect Rubric + Custom Test blocks for each test class. Each test block can link to a separate rubric category for grading.

Troubleshooting Maven Autograding in CodeGrade
This section lists common issues you may encounter when setting up Maven-based Java assignments in CodeGrade, along with quick solutions.
Still Need Help?
For assistance with custom cases, reach out to support@codegrade.com and share a relevant snapshot or example submission.
Last updated