Skip to content

Commit dcdc444

Browse files
authored
Generate META-INF file during build (#76)
* chore: generate META-INF file during build so the driver can be automatically loaded in user application
1 parent 5637725 commit dcdc444

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

wrapper/build.gradle.kts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,34 @@ ide {
131131
)
132132
}
133133

134+
java {
135+
withJavadocJar()
136+
withSourcesJar()
137+
sourceCompatibility = JavaVersion.VERSION_1_8
138+
targetCompatibility = JavaVersion.VERSION_1_8
139+
}
140+
141+
tasks.jar {
142+
from("${project.rootDir}") {
143+
include("README")
144+
include("LICENSE")
145+
include("THIRD-PARTY-LICENSES")
146+
into("META-INF/")
147+
}
148+
149+
from("${buildDir}/META-INF/services/") {
150+
into("META-INF/services/")
151+
}
152+
153+
doFirst {
154+
mkdir("${buildDir}/META-INF/services/")
155+
val driverFile = File("${buildDir}/META-INF/services/java.sql.Driver")
156+
if (driverFile.createNewFile()) {
157+
driverFile.writeText("com.amazon.awslabs.jdbc.Driver")
158+
}
159+
}
160+
}
161+
134162
tasks.withType<Test> {
135163
useJUnitPlatform()
136164

0 commit comments

Comments
 (0)