FINERACT-2181: Some tweaks in the gradle build to ensure correct task processing

This commit is contained in:
Adam Saghy
2025-05-25 22:12:22 +02:00
parent 25ef93a30b
commit 6cb60f48fc
36 changed files with 522 additions and 393 deletions
+29 -21
View File
@@ -21,23 +21,35 @@ description = 'Fineract Report'
apply plugin: 'java'
apply plugin: 'eclipse'
compileJava.doLast {
def mainSS = sourceSets.main
def source = mainSS.java.classesDirectory.get()
copy {
from file("src/main/resources/jpa/report/persistence.xml")
into "${source}/META-INF/"
}
javaexec {
description = 'Performs EclipseLink static weaving of entity classes'
def target = source
main 'org.eclipse.persistence.tools.weaving.jpa.StaticWeave'
args '-persistenceinfo', source, source, target
classpath sourceSets.main.runtimeClasspath
}
delete {
delete "${source}/META-INF/persistence.xml"
}
tasks.register('staticWeaveJpa', JavaExec) {
group = "build"
description = "Performs EclipseLink static weaving of entity classes"
dependsOn classes
def classesDir = file("$buildDir/classes/java/main")
mainClass.set('org.eclipse.persistence.tools.weaving.jpa.StaticWeave')
classpath = sourceSets.main.runtimeClasspath
args '-persistenceinfo', classesDir.absolutePath, classesDir.absolutePath, classesDir.absolutePath
}
staticWeaveJpa.doLast {
delete "${sourceSets.main.output.classesDirs.asPath}/META-INF/persistence.xml"
}
tasks.named('classes') {
finalizedBy staticWeaveJpa
}
tasks.named('processResources') {
from('src/main/resources')
into sourceSets.main.java.classesDirectory
outputs.upToDateWhen { false }
}
compileJava {
dependsOn ':fineract-avro-schemas:buildJavaSdk'
}
// Configuration for Swagger documentation generation task
@@ -91,10 +103,6 @@ eclipse {
}
}
/* http://stackoverflow.com/questions/19653311/jpa-repository-works-in-idea-and-production-but-not-in-gradle */
sourceSets.main.output.resourcesDir = sourceSets.main.java.classesDirectory
sourceSets.test.output.resourcesDir = sourceSets.test.java.classesDirectory
if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
sourceSets {
test {