Mosher's Law of Software Engineering
Don't worry if it doesn't work right. If everything did, you'd be out of a job.
build
logging
https://scans.gradle.com/s/g5imwm7fcw44u
automation
task
tool
Gradle-wrapper
구조
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar // 그레이들 래퍼 jar
│ └── gradle-wrapper.properties // 그레이들 래퍼 버전 및 실행환경 기록
├── gradlew // Unix 계열에서 실행가능한 스크립트
└── gradlew.bat // 윈도우에서 실행가능한 스크립트
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Ant
Maven
Gradle
이걸 왜 신경써야해 복잡한데 ㅠㅠ ?
--> compile, runtime에 따른 중복 클래스 사용을 피하고, 명확히 명시되어 깔끔하고, 필요한 classPath에만 의존성 lib를 넣어서 더 빠르다.
buildscript {
ext {
springBootVersion = '2.3.5.RELEASE'
queryDslVersion = "4.4.0"
log4j2version = '2.17.0'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'org.springframework.boot' version '2.3.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'war'
id 'eclipse'
id 'eclipse-wtp'
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}
if (!project.hasProperty('target') || !target) {
ext.target = 'tomcat'
}
// QUERYDSL ===================
apply plugin: "com.ewerk.gradle.plugins.querydsl"
def querydslDir = "$buildDir/generated/querydsl"
querydsl {
jpa = true
querydslSourcesDir = querydslDir
}
sourceSets {
main {
resources.srcDir "src/main/resources/profiles/${target}"
output.resourcesDir 'build/resources/main'
resources.exclude "**/profiles"
java.srcDir querydslDir
}
}
// //QUERYDSL ===================
group = 'com.project'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
querydsl.extendsFrom compileClasspath
compileOnly {
extendsFrom annotationProcessor
}
all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
providedRuntime
}
//QUERYDSL ===================
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}
////QUERYDSL ===================
repositories {
mavenCentral()
}
task local {
bootRun {
systemProperty("spring.profiles.active", "local")
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor
// compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor', version: '2.3.5.RELEASE'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
//Lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
// 스프링 부트 개발 툴(클래스 자동 리로더 등)
developmentOnly 'org.springframework.boot:spring-boot-devtools'
//QueryDSL
implementation("com.querydsl:querydsl-jpa:${queryDslVersion}")
// Maria DB
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
// Thymeleaf Layout
// https://mvnrepository.com/artifact/nz.net.ultraq.thymeleaf/thymeleaf-layout-dialect
implementation group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect', version: '2.5.1'
// https://mvnrepository.com/artifact/com.github.kevinsawicki/http-request
compile group: 'com.github.kevinsawicki', name: 'http-request', version: '6.0'
}
test {
useJUnitPlatform()
exclude '**/*'
}
https://medium.com/@257ramanrb/ant-vs-maven-vs-gradle-cd8ab4c2735f
https://www.baeldung.com/ant-maven-gradle
https://techblog.woowahan.com/2625/
https://tomgregory.com/gradle-implementation-vs-compile-dependencies/
https://techblog.bozho.net/runtime-classpath-vs-compile-time-classpath/
http://www.natpryce.com/articles/000749.html