Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration project from maven to gradle #17

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .github/workflows/maven.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
target/*
build/*
logs/*
.settings/*
.gradle/*
.classpath
.project
.idea
*.iml
/target
/build
/logs
.sts4-cache/
.vscode/*
!.vscode/settings.json
Expand Down
117 changes: 0 additions & 117 deletions .mvn/wrapper/MavenWrapperDownloader.java

This file was deleted.

Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 0 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties

This file was deleted.

16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM openjdk:17-jdk-slim

RUN useradd -r -u 1000 devops
RUN mkdir -p /logs /opt/devops
RUN chown devops /opt/devops /logs

USER devops
WORKDIR /opt/devops

ARG VERSION=3.0.0
ARG JAR_FILE=build/libs/spring-petclinic-data-jdbc-${VERSION}.jar
COPY ${JAR_FILE} /opt/devops/petclinic.jar
COPY src/main/resources/application.properties application.properties
COPY src/main/resources/logback-spring.xml logback-spring.xml

ENTRYPOINT java ${JAVA_OPTIONS} ${JAVA_AGENT_OPTIONS} -jar petclinic.jar
98 changes: 98 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.0.4'
id 'io.spring.dependency-management' version '1.1.0'
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
id 'jacoco'
id 'com.diffplug.spotless' version "6.18.0"
}

group = 'org.springframework.samples'
version = '3.0.0'
sourceCompatibility = '17'

repositories {
mavenCentral()
}

ext {
// Spring and Spring Boot dependencies
testContainersMysqlVersion = '1.17.6'

// Web dependencies
webjarsBootstrapVersion = '3.3.6'
webjarsJqueryUiVersion = '1.11.4'
webjarsJqueryVersion = '2.2.4'

jacocoVersion = '0.8.7'
}

dependencies {
// Spring and Spring Boot dependencies
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation "org.testcontainers:mysql:${testContainersMysqlVersion}"

// Databases
runtimeOnly 'com.mysql:mysql-connector-j'
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'

// Caching
implementation 'com.github.ben-manes.caffeine:caffeine'

// Webjars
implementation "org.webjars:jquery:${webjarsJqueryVersion}"
implementation "org.webjars:jquery-ui:${webjarsJqueryUiVersion}"
implementation "org.webjars:bootstrap:${webjarsBootstrapVersion}"

developmentOnly 'org.springframework.boot:spring-boot-devtools'

implementation 'ch.qos.logback:logback-classic:1.4.7'
implementation 'ch.qos.logback:logback-core:1.4.7'
}

jar {
enabled = false
}

gitProperties {
gitPropertiesName = "git.properties"
gitPropertiesResourceDir = buildDir
dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
dateFormatTimeZone = 'KST'
}

jacoco {
toolVersion = jacocoVersion
reportsDirectory = layout.buildDirectory.dir('customJacocoReportDir')
}

test {
finalizedBy jacocoTestReport
}

jacocoTestReport {
reports {
xml.required
html.required
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
}

spotless {
java {
importOrder()
licenseHeaderFile file("${project.rootDir}/etc/license.txt")
}
}

processResources.dependsOn(generateGitProperties)
processResources.dependsOn(compileJava)
processResources.dependsOn(spotlessInternalRegisterDependencies)
processResources.dependsOn(spotlessJava)
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading