Question about the Java builds at the CLI

I am doing many language tracks at the same time. I am doing kotlin and Java to practice both Intelli-j and just to have fun. I use the cli when building and testing with Kotlin and thought it would be nice to do that on Java when the problem is easy. In the kotlin track all the projects at the CLI have gradlew.bat and gradle for the projects. The Java projects do not have these files. I have found if I move the gradlew files from the kotlin version of the projects to the Java i can build them at the command line perfectly. My question after all that is why don’t the Java projects have the gradle command line scripts included when you download the projects.

This is a question for @sanderploegsma I think

This is a good question! To be honest I have never used the CLI to build and run tests, so I have no experience with this.

In general though, each track has their own requirements when it comes to a local development environment. For the Java track, students are required to install the JDK and Gradle locally, as instructed here: Installing Java locally | Exercism's Docs.

Looking at the Exercism CLI source code, it seems to be configured to run gradle test when invoked on a Java track exercise, so it assumes that students have a local installation of Gradle. When running the CLI on a Kotlin track it’s configured to use the Gradle wrapper, so that should work on any system where the JDK is installed, as long as the exercise provides the Gradle wrapper scripts.

It would be a nice improvement to the Java track to provide Gradle wrapper scripts with each exercise, similar to the Kotlin track. When this is done, the CLI could in theory be updated to use the Gradle wrapper by default when running exercism test on a Java track exercise.

UPDATE: I created a new issue for this suggestion: Provide Gradle wrapper with each exercise to simplify local development environment · Issue #2655 · exercism/java · GitHub

@krperry the Java track exercises have been updated to ship with the Gradle wrapper now, so your local environment only requires the JDK to be installed.

Note that the exercism test command still requires Gradle to be installed locally until this PR is merged and a new version of the CLI is released: test: use Gradle wrapper for Java track by sanderploegsma · Pull Request #1126 · exercism/cli · GitHub