Skip to content

Commit

Permalink
fix task deps apache#4
Browse files Browse the repository at this point in the history
  • Loading branch information
kjozsa committed Nov 14, 2024
1 parent ef0c11d commit 552500a
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions fineract-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
}
Expand Down

0 comments on commit 552500a

Please sign in to comment.