From 552500a6ac3b687546b4206c2a64f9da24252c6a Mon Sep 17 00:00:00 2001 From: Kristof Jozsa Date: Thu, 14 Nov 2024 12:06:24 +0100 Subject: [PATCH] fix task deps #4 --- fineract-provider/build.gradle | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index df9d4c89c2c..6bdb56e1ed5 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -39,25 +39,38 @@ task enhanceJPA(type: JavaExec) { dependsOn compileJava mustRunAfter compileJava + def enhancementDir = file("${buildDir}/enhanced-classes") inputs.files(compileJava) - outputs.dir(compileJava.destinationDirectory) + outputs.dir(enhancementDir) doFirst { - def source = compileJava.destinationDirectory.get().asFile + // Clean enhancement directory + enhancementDir.deleteDir() + enhancementDir.mkdirs() + + // Copy compiled classes to enhancement directory + copy { + from compileJava.destinationDirectory + into enhancementDir + } + + // Copy persistence.xml copy { from file("src/main/resources/jpa/persistence.xml") - into "${source}/META-INF/" + into "${enhancementDir}/META-INF/" } } main = 'org.eclipse.persistence.tools.weaving.jpa.StaticWeave' - def source = compileJava.destinationDirectory.get().asFile - args = ['-persistenceinfo', source, source, source] + args = ['-persistenceinfo', enhancementDir, enhancementDir, enhancementDir] classpath = sourceSets.main.runtimeClasspath doLast { - delete { - delete "${source}/META-INF/persistence.xml" + // Copy enhanced classes back + copy { + from enhancementDir + into compileJava.destinationDirectory + exclude 'META-INF/persistence.xml' } } }