Skip to content

Commit

Permalink
Fix broken ./gradlew test and ./gradlew bootRun commands because …
Browse files Browse the repository at this point in the history
…of missing MySQL jdbc driver (#58)

* Make sure the MySQL jdbc driver is included

Add additional settings for the initial directory also works
and does not error with `./gradlw test` or `./gradlew bootRun`.

* Fix docker-compose.yml files

* Added mysql connector for maven

---------

Co-authored-by: Ruben Klink <=>
Co-authored-by: Robert McNees <[email protected]>
  • Loading branch information
j0holo and Robert McNees authored May 6, 2024
1 parent 8992b6c commit 7bd32b6
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 15 deletions.
1 change: 1 addition & 0 deletions complete/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'com.mysql:mysql-connector-j'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

Expand Down
27 changes: 14 additions & 13 deletions complete/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
mysql:
image: mysql
ports:
- "3306:3306"
expose:
- "3306"
environment:
- MYSQL_USER=springuser
- MYSQL_PASSWORD=ThePassword
- MYSQL_DATABASE=db_example
- MYSQL_ROOT_PASSWORD=root
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"
services:
mysql:
image: mysql
ports:
- "3306:3306"
expose:
- "3306"
environment:
- MYSQL_USER=springuser
- MYSQL_PASSWORD=ThePassword
- MYSQL_DATABASE=db_example
- MYSQL_ROOT_PASSWORD=root
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"
6 changes: 5 additions & 1 deletion complete/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
1 change: 1 addition & 0 deletions initial/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'com.mysql:mysql-connector-j'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

Expand Down
14 changes: 14 additions & 0 deletions initial/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
mysql:
image: mysql
ports:
- "3306:3306"
expose:
- "3306"
environment:
- MYSQL_USER=springuser
- MYSQL_PASSWORD=ThePassword
- MYSQL_DATABASE=db_example
- MYSQL_ROOT_PASSWORD=root
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"
6 changes: 5 additions & 1 deletion initial/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
1 change: 1 addition & 0 deletions initial/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/db_example
spring.datasource.username=springuser
spring.datasource.password=ThePassword
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

0 comments on commit 7bd32b6

Please sign in to comment.