Skip to content

Commit

Permalink
Add Spring example: Getting the Required dependencies with Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
pkainulainen committed Jun 30, 2020
1 parent 716f8f6 commit 751f78e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
6 changes: 6 additions & 0 deletions getting-required-dependencies/spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ You need to install the following tools if you want to run this application:
You can run the application by using the following command:

mvn clean jetty:run

# Running the Application With Gradle

You can run the application by using the following command:

gradle clean appRun
47 changes: 47 additions & 0 deletions getting-required-dependencies/spring/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE' apply false
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'war'
id "org.gretty" version "3.0.3"
}

dependencyManagement {
imports {
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
}
}

repositories {
mavenCentral()
//We need to use this repository because at the moment the JCenter
//Maven repository doesn't have the latest version (3.0.3) of the gretty-runner-jetty94
//dependency.
maven {
url 'https://repo.spring.io/plugins-release/'
}
}

dependencies {
implementation(
'org.slf4j:slf4j-api',
'org.liquibase:liquibase-core',
'com.zaxxer:HikariCP',
'org.springframework:spring-aspects',
'org.springframework:spring-context-support',
'org.springframework:spring-jdbc',
'org.springframework:spring-webmvc',
'org.springframework.batch:spring-batch-core'
)
runtimeOnly(
'org.apache.logging.log4j:log4j-api',
'org.apache.logging.log4j:log4j-core',
'org.apache.logging.log4j:log4j-slf4j-impl',
//We need to add this because of Gretty :( This leads
//into a situation where multiple SLF4J bindings
//are present in the classpath, but I think that
//this is an acceptable compromise because otherwise
//the application won't start.
'ch.qos.logback:logback-classic',
'com.h2database:h2'
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory exists only because we don't want that the Jetty throws an exception
when it's started.

0 comments on commit 751f78e

Please sign in to comment.