Gradle Create Java project structure automatically

摘要: To quick start a new Gradle Java project, type gradle init --type java-library

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

  1. Gradle build init plugin

上一篇: Java Math.pow example
下一篇: Spring Data MongoDB Aggregation Grouping Example
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号