You can use Build Init Plugin to generate a new Gradle build.
The java-application generates a new multi-module project with one submodule app
.
The henerated project has the following layout:
.
├── app
│ ...
│ └── build.gradle
└── settings.gradle
JUnit 4 is used as a default test framework. java-application type has a test-framework
parameter to specify another framework to use:
- junit-jupiter - to use JUnit Jupiter aka JUnit5
- spock - to use Spock
- testng - to use TestNG
For example to generate a new java project build with JUnit5 as a tes framework run within the project directory:
gradle init --type java-application --test-framework junit-jupiter