gradle : multiple spring boot project

file structure :
application
- build.gradle
- settings.gradle
- core
-- src
--- main
---- java
----- com
------ application
---- resouces
----- application.properties
-- build.gradle
- db
-- build.gradle
- model
-- build.gradle

application : build.gradle setting

allprojects {
    group = 'com.test'
    version = '1.0.0.1'
}

subprojects {
    apply plugin: 'java'
    project.ext {
        springBootVersion = '1.3.6.RELEASE'
    }
    repositories {
        mavenLocal()
        mavenCentral()     }
}
application : settings.gradle

rootProject.name = 'application'
include 'core', 'model', 'db'
core : build.gradle

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }

    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE'
    }
}

description = 'core'

apply plugin: 'application'
apply plugin: 'spring-boot'

 dependencies {
    compile 'org.springframework.boot:spring-boot-starter'
    compile project(":db")
    compile project(":model")  

    testCompile 'org.springframework.boot:spring-boot-starter-test'
}

mainClassName = 'com.application'

core : com.application

package com;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
db : build.gradle
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE' 
    }
}

description = 'db'
apply plugin: 'spring-boot'

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-data-jpa'
    compile project(":model")
}
model : build.gradle
 buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE' 
    }
}

description = 'model'
apply plugin: 'spring-boot'
dependencies {
    compile 'org.springframework.boot:spring-boot-starter-aop'
}

留言

這個網誌中的熱門文章

Embedded Tomcat

COSCUP2010

SWT SSH terminal