Skip to content

Development Setup

This guide will help you set up your development environment for contributing to MARSLib. The setup process takes about 10-15 minutes.

  • Java 17 - Development JDK.
  • Gradle 8.5+ - Build system (included with project)
  • Git - Version control.
  • VS Code - Recommended IDE (with extensions)
  • Node.js 18+ - For website development.
  • AdvantageScope - Telemetry visualization.
  • WPILib VS Code Extension - FRC development support.
  1. Go to github.com/MARSProgramming/MARSLib
  2. Click the “Fork” button in the top-right.
  3. Choose your GitHub account as the destination.
Terminal window
# Clone your fork
git clone https://github.com/YOUR_USERNAME/MARSLib.git
cd MARSLib
# Add upstream repository
git remote add upstream https://github.com/MARSProgramming/MARSLib.git

The project includes Gradle Wrapper, so you don’t need to install Gradle separately:

Terminal window
# On Windows
.\gradlew.bat build
# On macOS/Linux
./gradlew build
Terminal window
# Run tests to verify setup
.\gradlew.bat test
# Run simulation to verify physics
.\gradlew simulateJava

Install these VS Code extensions for best development:

  • Extension Pack for Java (Microsoft)
  • Gradle for Java (Microsoft)
  • WPILib (WPILib contributors)
  • Markdown All in One (for documentation)

Create .vscode/settings.json (if not present):

{
"java.format.settings.url": "https://raw.githubusercontent.com/MARSProgramming/MARSLib/master/spotless.license",
"java.configuration.updateBuildConfiguration": "automatic",
"java.import.gradle.enabled": true,
"files.associations": {
"*.gradle": "groovy"
}
}
Terminal window
cd website
npm install
Terminal window
npm run dev

The website will be available at http://localhost:4321

Terminal window
npm run build

Install git hooks to automatically format code before commits:

Terminal window
# On Windows
.\install-git-hooks.bat
# On macOS/Linux
chmod +x .githooks/pre-commit

This ensures your code follows MARSLib formatting standards automatically.

Terminal window
.\gradlew.bat build
Terminal window
.\gradlew.bat test
Terminal window
.\gradlew.bat simulateJava
Terminal window
cd website
npm run dev
Terminal window
git checkout -b feature/your-feature-name
  • Edit code in src/main/java/
  • Add tests in src/test/java/
  • Update documentation if needed.
Terminal window
# Run all tests
.\gradlew.bat test
# Run specific test
.\gradlew.bat test --tests SwerveDriveTest
# Run simulation
.\gradlew.bat simulateJava
Terminal window
git add .
git commit -m "Descriptive commit message"
Terminal window
git push origin feature/your-feature-name

Then create a pull request on GitHub.

Terminal window
# Build entire project
.\gradlew.bat build
# Build without tests
.\gradlew.bat build -x test
# Clean build artifacts
.\gradlew.bat clean
Terminal window
# Run all tests
.\gradlew.bat test
# Run with coverage
.\gradlew.bat test jacocoTestReport
# Run specific test class
.\gradlew.bat test --tests MARSTestHarness
# Run simulation tests
.\gradlew.bat simulateJava
Terminal window
# Generate JavaDoc
.\gradlew.bat generateDocs
# View generated docs
# Open docs/javadoc/index.html
Terminal window
# Deploy to robot
.\gradlew.bat deploy
# Build deployment JAR
.\gradlew.bat buildDeploymentJar

Ensure you’re using Java 17:

Terminal window
java -version
# Should show "17.x.x"

Try cleaning and rebuilding:

Terminal window
.\gradlew.bat clean build --refresh-dependencies

Make sure you’ve initialized HAL:

Terminal window
# Tests should call this automatically
HAL.initialize(500, 0);

Clear node_modules and reinstall:

Terminal window
cd website
rm -rf node_modules package-lock.json
npm install
  1. Read our Coding Standards to understand our patterns.
  2. Learn about our Testing Philosophy .
  3. Find a good first issue.
  4. Join our GitHub Discussions.

Ready to code? Check out our Coding Standards to learn MARSLib patterns!