Generate a working build.gradle in seconds
A build.gradle file is the heart of any Gradle project: it declares which plugins apply, where dependencies come from, what libraries the code needs, and how tasks like test behave. Writing one by hand means remembering the exact plugin IDs, the difference between implementation and testImplementation, and the toolchain syntax. This builder assembles a correct, idiomatic file from a few choices.
How it works
The tool follows the standard Gradle JVM build layout. It always emits a plugins { } block (java plus application for runnable apps, or just java/java-library for libraries; the Kotlin JVM plugin is added for Kotlin projects). It sets group and version, configures a java { toolchain { languageVersion = JavaLanguageVersion.of(N) } } block so the build pins its JDK, and adds repositories { mavenCentral() }. Dependencies you type are split into implementation and testImplementation lines inside dependencies { }. Finally it adds tasks.named('test') { useJUnitPlatform() } so JUnit 5 tests run, and for applications a mainClass is wired into the application { } block.
Tips and notes
- Use
implementationfor anything your own code imports, and reserveapi(library projects) only for dependencies you intentionally re-expose. - Dependency coordinates follow
group:artifact:version, e.g.com.google.guava:guava:33.0.0-jre. - For Kotlin, the generated file applies the
org.jetbrains.kotlin.jvmplugin and adds the standard library automatically. - Pair this with a
settings.gradlecontainingrootProject.name = 'your-project'; Gradle needs both to build.