Skip to content

Commit

Permalink
[*] Modified the auto build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Lei-Tin committed Dec 7, 2022
1 parent b03c33a commit 6f887d8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
java-version: '17'
distribution: 'corretto'
- name: Build with Gradle
- name: Build with Gradle shadowJar
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
arguments: shadowJar
20 changes: 19 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
id("java-library") // or id("application")
id("java-library")
}

repositories {
Expand All @@ -18,6 +19,8 @@ dependencies {
testImplementation('org.junit.jupiter:junit-jupiter:5.6.0')
testImplementation 'junit:junit:4.13.1'

shadow 'junit:junit:3.8.2'

// https://mvnrepository.com/artifact/mysql/mysql-connector-java
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.31'

Expand All @@ -33,3 +36,18 @@ test {
events "passed", "skipped", "failed"
}
}

shadowJar {
archiveBaseName.set('BillGates')
archiveClassifier.set('')
archiveVersion.set('0.1.0')
}

jar {
manifest {
attributes(
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' '),
'Main-Class': "billgates.Main"
)
}
}
3 changes: 1 addition & 2 deletions src/main/java/billgates/database/MySQLDatabaseGateway.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import billgates.interface_adapters.DatabaseGateway;
import billgates.view.BillGatesUtilities;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
Expand Down Expand Up @@ -44,7 +43,7 @@ public MySQLDatabaseGateway() {
}

public void initializeConnection() {
try (InputStream input = new FileInputStream("src/main/resources/config.properties")) {
try (InputStream input = this.getClass().getClassLoader().getResourceAsStream("config.properties")) {

Properties prop = new Properties();

Expand Down

0 comments on commit 6f887d8

Please sign in to comment.