Gunju-Ko / TIL

Today I Learn
0 stars 0 forks source link

gradle 멀티 모듈 프로젝트 #32

Open Gunju-Ko opened 3 years ago

Gunju-Ko commented 3 years ago

관련 글 정리

Gunju-Ko commented 3 years ago

다른 모듈 사용하기

dependencies {
    implementation(project(":shared"))
    implementation(project(":api"))
}
Gunju-Ko commented 3 years ago

apply plugin과 plugins 차이점

apply plugin: 'someplugin1'
apply plugin: 'maven'
plugins {
   id 'org.hidetake.ssh' version '1.1.2'
}

pluginManagement

pluginManagement {
    repositories {
        maven {
            url '../maven-repo'
        }
        gradlePluginPortal()
        ivy {
            url '../ivy-repo'
        }
    }
}
plugins {
    id 'com.example.hello' version '1.0.0' apply false
    id 'com.example.goodbye' version '1.0.0' apply false
}

subprojects {
    if (name.startsWith('hello')) {
        apply plugin: 'com.example.hello'
    }
}

간단한 예시

plugins {
  id "org.springframework.boot" version "2.0.1.RELEASE"
}
buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.1.RELEASE"
  }
}

apply plugin: "org.springframework.boot"

출처