File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
6075tasks. named(" build" ) {
6176 dependsOn(" spotlessApply" )
6277}
@@ -65,8 +80,6 @@ tasks.named("bootRun") {
6580 dependsOn(' flywayMigrate' )
6681}
6782
68-
69-
7083repositories {
7184 mavenCentral()
7285}
@@ -127,13 +140,18 @@ bootRun
127140 }
128141}
129142
143+
144+
145+ compileTestJava {
146+ dependsOn createKeys
147+ }
148+
130149test {
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
139157jacocoTestReport {
You can’t perform that action at this time.
0 commit comments