Skip to content

Commit 0592c63

Browse files
committed
fix issue with test on clean
1 parent 900e623 commit 0592c63

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

server/build.gradle

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ spotless {
5757
}
5858
}
5959

60+
task createKeys(type: JavaExec) {
61+
main = 'dev.findfirst.security.util.KeyGenerator' // Replace with the fully qualified class name of your utility
62+
classpath = sourceSets.main.runtimeClasspath
63+
executable = javaToolchains.launcherFor(java.toolchain).get().executablePath
64+
doLast {
65+
def keyFile = file("${projectDir}/src/main/resources/app.key")
66+
println "Keys generated at: ${keyFile}"
67+
68+
copy {
69+
from keyFile.getParent()
70+
include "app.*"
71+
into "${buildDir}/resources/main"
72+
}
73+
}}
74+
6075
tasks.named("build") {
6176
dependsOn("spotlessApply")
6277
}
@@ -65,8 +80,6 @@ tasks.named("bootRun") {
6580
dependsOn('flywayMigrate')
6681
}
6782

68-
69-
7083
repositories {
7184
mavenCentral()
7285
}
@@ -127,13 +140,18 @@ bootRun
127140
}
128141
}
129142

143+
144+
145+
compileTestJava {
146+
dependsOn createKeys
147+
}
148+
130149
test {
131150
jvmArgs "-javaagent:${configurations.testRuntimeClasspath.find { it.name.contains('mockito-core') }}", '-Xshare:off'
132151
systemProperty 'spring.profiles.active', 'integration'
133152
useJUnitPlatform()
134153
testLogging.showStandardStreams = true
135154
finalizedBy jacocoTestReport // report is always generated after tests run
136-
dependsOn("createKeys")
137155
}
138156

139157
jacocoTestReport {

0 commit comments

Comments
 (0)