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
core : com.application
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 {application : settings.gradle
springBootVersion = '1.3.6.RELEASE'
}
repositories {
mavenLocal()
mavenCentral() }
}
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' }
留言
張貼留言