Gradle Create Java project structure automatically
By:Roy.LiuLast updated:2019-08-17
To quick start a new Gradle Java project, type gradle init --type java-library
$ gradle init --type java-library :wrapper :init BUILD SUCCESSFUL Total time: 4.866 secs
The following files and folders will be created automatically.
P.S Tested with Gradle 2.0
1. Java Project Structure
Both src/main/java and src/test/java folders are created. The Library*.java is a sample file, just delete it.
2. Gradle Files
1. A simple gradle.build file for Java project.
gradle.build
apply plugin: 'java' repositories { mavenCentral() dependencies { compile 'org.slf4j:slf4j-api:1.7.5' testCompile 'junit:junit:4.11'
2. A simple settings.build file, for multi project build. Ignore this file if you are not going to create a multi module project.
settings.build
rootProject.name = 'your-project-folder'
3. Some Gradle wrapper files.
References
From:一号门
Previous:Java Math.pow example
COMMENTS