Skip to content

Commit

Permalink
Use convention in gradle project structure
Browse files Browse the repository at this point in the history
Signed-off-by: Taeik Lim <[email protected]>
  • Loading branch information
acktsap committed May 29, 2024
1 parent f7584a1 commit 584de37
Show file tree
Hide file tree
Showing 20 changed files with 233 additions and 201 deletions.
160 changes: 0 additions & 160 deletions build.gradle

This file was deleted.

16 changes: 16 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
id "groovy-gradle-plugin"
}

repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal() // give access to gradle community plugins
maven {
url "https://repo.spring.io/milestone/"
}
}

dependencies {
implementation "io.spring.gradle:dependency-management-plugin:1.1.5"
}
36 changes: 36 additions & 0 deletions buildSrc/src/main/groovy/spring.jdbc.plus.java-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
id "java-library"
id "checkstyle"
id "idea"
}

java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType(Javadoc).configureEach { enabled = false }

tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-parameters'
}

test {
useJUnitPlatform()
}

checkstyle {
configFile = file("${project.rootDir}/rule/naver-checkstyle-rules.xml")
configProperties = ["suppressionFile": "${project.rootDir}/tool/naver-checkstyle-suppressions.xml"]
toolVersion = "9.1"
ignoreFailures = true // TODO: return to false
maxErrors = 0
maxWarnings = 0
}

dependencies {
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
testCompileOnly("com.google.code.findbugs:jsr305:3.0.2")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
plugins {
id "maven-publish"
id "signing"
}

group = "com.navercorp.spring"
version = "3.3.0-SNAPSHOT"

publishing {
publications {
mavenJava(MavenPublication) {
from components.java

repositories {
maven {
def ossrhUsername = project.hasProperty("ossrhUsername") ? ossrhUsername : ""
def ossrhPassword = project.hasProperty("ossrhPassword") ? ossrhPassword : ""

credentials {
username ossrhUsername
password ossrhPassword
}

def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
}
}

versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}

pom {
name = "Spring JDBC Plus"
description = "Spring JDBC Plus"
url = "http://github.com/naver/spring-jdbc-plus"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "mhyeon-lee"
name = "Myeonghyeon Lee"
email = "[email protected]"
}
developer {
id = "yd-2"
name = "Youngdae Lee"
email = "[email protected]"
}
developer {
id = "chanhyeong"
name = "Chanhyeong Cho"
email = "[email protected]"
}
developer {
id = "wool0826"
name = "Chanwool Jo"
email = "[email protected]"
}
}
scm {
connection = "scm:git:git://github.com/naver/spring-jdbc-plus.git"
developerConnection = "scm:git:git://github.com/naver/spring-jdbc-plus.git"
url = "https://github.com/naver/spring-jdbc-plus"
}
}
}
}
}

signing {
sign publishing.publications.mavenJava
}

tasks.withType(Sign) {
onlyIf { !version.endsWith("SNAPSHOT") }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id "io.spring.dependency-management"
}

dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:${springBootVersion}") {
bomProperties([
"spring-data-bom.version": "${springDataBomVersion}"
])
}
}
}
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
springBootVersion=3.3.0-RC1
springDataBomVersion=2024.0.0-RC1
kotlinVersion=1.9.20
5 changes: 5 additions & 0 deletions guide-projects/plus-repository-guide/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id "spring.jdbc.plus.java-conventions"
id "spring.jdbc.plus.spring-bom-conventions"
}

dependencies {
implementation project(':spring-boot-starter-data-jdbc-plus-repository')

Expand Down
7 changes: 2 additions & 5 deletions guide-projects/plus-sql-java-groovy-guide/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
plugins {
id "java"
id "spring.jdbc.plus.java-conventions"
id "spring.jdbc.plus.spring-bom-conventions"
id "groovy"
}

repositories {
mavenCentral()
}

compileGroovy {
options.encoding = "UTF-8"
groovyOptions.encoding = "UTF-8"
Expand Down
19 changes: 5 additions & 14 deletions guide-projects/plus-sql-java-kotlin-guide/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
}
}

apply plugin: "java"
apply plugin: "kotlin"

repositories {
mavenCentral()
plugins {
id "spring.jdbc.plus.java-conventions"
id "spring.jdbc.plus.spring-bom-conventions"
id "org.jetbrains.kotlin.jvm" version "1.9.20"
}

compileKotlin {
Expand All @@ -21,6 +11,7 @@ compileKotlin {
jvmTarget = "17"
}
}

compileTestKotlin {
kotlinOptions {
javaParameters = true
Expand Down
Loading

0 comments on commit 584de37

Please sign in to comment.