멀티프로젝트 생성 Eclipse STS + Multi Gradle

2017. 10. 18. 13:3199. 정리전 - IT/11. Java

Eclipse STS + MultiGradle +  Subproject Spring Boot(1.5.8)


사전설정
이클립스 마켓에서 등록해 참조 : http://donzbox.tistory.com/593

전체구조


부모프로젝트 생성


첫번째 자식 프로젝트 생성 (프로젝트 Location 설정 : 부모프로젝트 밑으로 변경해야 함)


두번째 자식 프로젝트 생성 (프로젝트 Location 설정 : 부모프로젝트 밑으로 변경해야 함)


부모프로젝트에서 자식프로젝트 연결 설정


/*

 * This build file was generated by the Gradle 'init' task.

 *

 * This generated file contains a sample Java Library project to get you started.

 * For more details take a look at the Java Libraries chapter in the Gradle

 * user guide available at https://docs.gradle.org/3.5/userguide/java_library_plugin.html

 */

subprojects {


// Apply the java-library plugin to add support for Java Library

apply plugin: 'java-library'

ext {

buildVersion = '0.0.1-SNAPSHOT'

springBootVersion = '1.5.6.RELEASE'

checkGradleVersion = '2.1.0'

}

// In this section you declare where to find the dependencies of your project

repositories {

    // Use jcenter for resolving your dependencies.

    // You can declare any Maven/Ivy/file repository here.

    jcenter()

}


dependencies {

    // This dependency is exported to consumers, that is to say found on their compile classpath.

    api 'org.apache.commons:commons-math3:3.6.1'


    // This dependency is used internally, and not exposed to consumers on their own compile classpath.

    implementation 'com.google.guava:guava:21.0'

    // Use JUnit test framework

    testImplementation 'junit:junit:4.12'

    runtime("org.springframework.boot:spring-boot-devtools:${springBootVersion}")

}

}


부모프로젝트에서 컴파일 하여 subprojects 에 선언한 dependencies 가 추가 시킴


자식프로젝트 homepage-api, homepage-batch 양쪽에 Referenced Libraries 속에

spring-boot-debtools1.5.6RELEASE.jar 가 추가됨을 확인


우오앗! 잘되네! 끝!


20190327

추가백업 (아, 왜 이클립스서 git에 올렸다 새로 생성하며 내려받으면 multi 구조가 깨지는 걸까.... 어떻게 하는거지...)


부모 build.gradle

 /*

 * This build file was generated by the Gradle 'init' task.

 *

 * This generated file contains a sample Java Library project to get you started.

 * For more details take a look at the Java Libraries chapter in the Gradle

 * user guide available at https://docs.gradle.org/3.5/userguide/java_library_plugin.html

 */


subprojects {


task -> println "I'm $task.project.name."

println "-----------------------------------------------------"

    version = '1.0'


    apply plugin: 'java'

apply plugin: 'java-library'

    apply plugin: 'eclipse'

apply plugin: 'eclipse-wtp'

apply plugin: 'war'

    group 'com.donzbox'


ext {

buildVersion = '0.0.1-SNAPSHOT'

springBootVersion = '1.5.8.RELEASE'

checkGradleVersion = '2.1.0'

}

    

    repositories {

mavenCentral()

jcenter()

maven {

url 'https://maven.atlassian.com/3rdparty'

}

    }


configurations {

    providedRuntime

}


    war {

    version = "${buildVersion}"

        manifest.attributes provider: 'DonzBox.com'

    }

    

dependencies {

/*+---------------------------------------------------------------------------------------

*| multi gradle set

*+--------------------------------------------------------------------------------------*/

compile("com.googlecode.json-simple:json-simple:1.1.1")

/*+---------------------------------------------------------------------------------------

*| spring-boot

*+--------------------------------------------------------------------------------------*/

/*+---------------------------------------------------------------------------------------

*| web

*+--------------------------------------------------------------------------------------*/

/*+---------------------------------------------------------------------------------------

*| social / cloud / 3rd

*+--------------------------------------------------------------------------------------*/

/*+---------------------------------------------------------------------------------------

*| api

*+--------------------------------------------------------------------------------------*/

/*+---------------------------------------------------------------------------------------

*| i18n

*+--------------------------------------------------------------------------------------*/

/*+---------------------------------------------------------------------------------------

*| securitydatabase

*+--------------------------------------------------------------------------------------*/

compile("com.github.ulisesbocchio:jasypt-spring-boot-starter:1.17")

/*+---------------------------------------------------------------------------------------

*| database

*+--------------------------------------------------------------------------------------*/

compile("com.oracle:ojdbc6:11.2.0.4.0-atlassian-hosted")

compile("mysql:mysql-connector-java:8.0.8-dmr")

compile("org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1")

compile("org.apache.commons:commons-dbcp2:2.1.1")


/*+---------------------------------------------------------------------------------------

*| log

*+--------------------------------------------------------------------------------------*/

compile("org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16")

compile("org.logback-extensions:logback-ext-spring:0.1.2")

    /*+---------------------------------------------------------------------------------------

     *| Development (auto set/get)

     *+--------------------------------------------------------------------------------------*/

compile("org.projectlombok:lombok:1.16.18")

    testCompile("junit:junit:4.12")

    compile("junit:junit:4.12")

}


}



자식 build.gradle

buildscript {

ext {

buildVersion = "0.0.1-SNAPSHOT"

springBootVersion = '1.5.8.RELEASE'

}

repositories {

mavenCentral()

}

dependencies {

classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")

}

}


apply plugin: 'java'

apply plugin: 'eclipse-wtp'

apply plugin: 'org.springframework.boot'

apply plugin: 'war'


war {

    baseName = "homepage-front"

//  version = "${buildVersion}"

}


group = 'com.donzbox'

version = '0.0.1-SNAPSHOT'

sourceCompatibility = 1.8


repositories {

mavenCentral()

}


configurations {

providedRuntime

}


dependencies {

/*+---------------------------------------------------------------------------------------

*| multi gradle set

*+--------------------------------------------------------------------------------------*/

/*+---------------------------------------------------------------------------------------

*| spring-boot

*+--------------------------------------------------------------------------------------*/

compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}")


/*+---------------------------------------------------------------------------------------

*| web

*+--------------------------------------------------------------------------------------*/

compile("net.sourceforge.nekohtml:nekohtml")

compile("org.springframework.boot:spring-boot-starter-thymeleaf:${springBootVersion}")

compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")

runtime("org.springframework.boot:spring-boot-devtools:${springBootVersion}")

compile("org.thymeleaf.extras:thymeleaf-extras-springsecurity4:2.1.2.RELEASE")


/*+---------------------------------------------------------------------------------------

*| social

*+--------------------------------------------------------------------------------------*/


/*+---------------------------------------------------------------------------------------

*| was

*+--------------------------------------------------------------------------------------*/

providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")


/*+---------------------------------------------------------------------------------------

*| api

*+--------------------------------------------------------------------------------------*/


/*+---------------------------------------------------------------------------------------

*| i18n

*+--------------------------------------------------------------------------------------*/

compile("org.ehcache:ehcache:3.4.0")


/*+---------------------------------------------------------------------------------------

*| database

*+--------------------------------------------------------------------------------------*/


/*+---------------------------------------------------------------------------------------

*| reCapture

*+--------------------------------------------------------------------------------------*/

compile("org.apache.httpcomponents:httpclient:4.5.4")


/*+---------------------------------------------------------------------------------------

*| log

*+--------------------------------------------------------------------------------------*/

/*+---------------------------------------------------------------------------------------

*| bitcoin bithumb

*+--------------------------------------------------------------------------------------*/

compile("commons-codec:commons-codec:1.11")

compile("com.google.guava:guava:23.6-jre")

compile("org.codehaus.jackson:jackson-mapper-asl:1.9.13")

    /*+---------------------------------------------------------------------------------------

     *| Development (auto set/get)

     *+--------------------------------------------------------------------------------------*/

testCompile('org.springframework.boot:spring-boot-starter-test')

}