Skip to content

Commit 46674fe

Browse files
authored
Finishing up Gradle multi-project setup (#23)
* finishing up * webapp
1 parent 084ec65 commit 46674fe

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ See below details on how to start each of them.
1616
This project uses [Maven](https://maven.apache.org/what-is-maven.html)
1717
as build tool.
1818

19-
In order to build it, just do the well-known:
19+
In order to build it, just run the well-known Maven command:
2020

2121
```
2222
mvn clean install
@@ -28,6 +28,12 @@ To build without executing automated tests:
2828
mvn clean install -DskipTests
2929
```
3030

31+
Alternatively, Gradle can also be used:
32+
33+
```
34+
gradle clean build
35+
```
36+
3137
Java 21 is used for this project.
3238

3339
## Starting Spring Boot REST Application
@@ -39,6 +45,12 @@ in the project's root directory:
3945
mvn -pl restapp spring-boot:run
4046
```
4147

48+
Alternatively, the following Gradle command can also be used:
49+
50+
```
51+
gradle :restapp:bootRun
52+
```
53+
4254
The following REST operations, as defined in the OpenAPI specification,
4355
will be exposed on HTTP `localhost:9090`:
4456

@@ -54,6 +66,12 @@ in the project's root directory:
5466
mvn -pl webapp spring-boot:run
5567
```
5668

69+
Alternatively, the following Gradle command can also be used:
70+
71+
```
72+
gradle :webapp:bootRun
73+
```
74+
5775
Open the browser and go to the following address:
5876

5977
```

openapi-spec/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ buildscript {
1414

1515
plugins {
1616
id 'buildlogic.java-conventions'
17+
id 'org.openapi.generator' version '7.12.0'
1718
}
1819

19-
apply plugin: 'org.openapi.generator'
20-
2120
dependencies {
2221
api libs.com.google.code.findbugs.jsr305
2322
api libs.com.google.code.gson.gson

restapp/build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44

55
plugins {
66
id 'buildlogic.java-conventions'
7+
id 'org.springframework.boot'
8+
id 'io.spring.dependency-management'
9+
id 'java'
710
}
811

912
dependencies {
10-
api project(':openapi-spec')
13+
implementation project(':openapi-spec')
1114
api libs.com.google.zxing.core
1215
api libs.com.google.zxing.javase
1316
api libs.org.springframework.boot.spring.boot.starter
@@ -16,3 +19,7 @@ dependencies {
1619
}
1720

1821
description = 'REST layer'
22+
23+
springBoot {
24+
mainClass = 'edu.training.qrcodeapp.rest.QRCodeGeneratorRestApp'
25+
}

settings.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
* This file was generated by the Gradle 'init' task.
33
*/
44

5+
pluginManagement {
6+
plugins {
7+
id 'org.springframework.boot' version '3.4.4'
8+
id 'io.spring.dependency-management' version '1.1.7'
9+
}
10+
}
11+
512
rootProject.name = 'qrcodeapp'
613
include(':openapi-spec')
714
include(':restapp')

webapp/build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44

55
plugins {
66
id 'buildlogic.java-conventions'
7+
id 'org.springframework.boot'
8+
id 'io.spring.dependency-management'
9+
id 'java'
710
}
811

912
dependencies {
10-
api project(':openapi-spec')
13+
implementation project(':openapi-spec')
1114
api libs.org.springframework.boot.spring.boot.starter.validation
1215
api libs.org.springframework.boot.spring.boot.starter.web
1316
api libs.org.springframework.boot.spring.boot.starter.thymeleaf
@@ -19,3 +22,7 @@ dependencies {
1922
}
2023

2124
description = 'Web Application'
25+
26+
springBoot {
27+
mainClass = 'edu.training.qrcodeapp.web.QRCodeGeneratorWebApp'
28+
}

0 commit comments

Comments
 (0)