diff --git a/build.gradle b/build.gradle index 6505beb8a31..a1ee281510e 100644 --- a/build.gradle +++ b/build.gradle @@ -323,12 +323,57 @@ configure(project.fineractJavaProjects) { apply plugin: 'idea' apply plugin: 'jacoco' apply plugin: 'checkstyle' - apply plugin: 'net.ltgt.errorprone' + apply plugin: 'pmd' + apply plugin: 'spotbugs' apply plugin: 'com.github.spotbugs' - apply plugin: 'com.github.andygoossens.modernizer' - apply from: "${rootDir}/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle" + apply plugin: 'org.nosphere.apache.rat' + apply plugin: 'com.github.hierynomus.license' + apply plugin: 'org.springframework.boot' + apply plugin: 'io.spring.dependency-management' + apply plugin: 'com.diffplug.spotless' + apply plugin: 'pmd-settings' + apply plugin: 'checkstyle-settings' + apply plugin: 'spotbugs-settings' + apply plugin: 'io.freefair.lombok' + + sourceSets { + main { + output.resourcesDir = file("${buildDir}/resources/main") + } + test { + output.resourcesDir = file("${buildDir}/resources/test") + } + } - group = 'org.apache.fineract' + // Configuration for JPA enhancement + task enhanceJPA(type: JavaExec) { + description = 'Performs static weaving of entity classes' + group = 'build' + + inputs.files(sourceSets.main.output.classesDirs) + outputs.dir(sourceSets.main.output.classesDirs) + + doFirst { + def source = sourceSets.main.java.classesDirectory.get() + copy { + from file("src/main/resources/jpa/persistence.xml") + into "${source}/META-INF/" + } + } + + main = 'org.eclipse.persistence.tools.weaving.jpa.StaticWeave' + def source = sourceSets.main.java.classesDirectory.get() + args = ['-persistenceinfo', source, source, source] + classpath = sourceSets.main.runtimeClasspath + + doLast { + delete { + delete "${source}/META-INF/persistence.xml" + } + } + } + + compileJava.finalizedBy enhanceJPA /* define the valid syntax level for source files */ sourceCompatibility = JavaVersion.VERSION_17 @@ -336,8 +381,8 @@ configure(project.fineractJavaProjects) { targetCompatibility = JavaVersion.VERSION_17 /* 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 + // sourceSets.main.output.resourcesDir = sourceSets.main.java.classesDirectory + // sourceSets.test.output.resourcesDir = sourceSets.test.java.classesDirectory configurations.named('spotbugs').configure { resolutionStrategy.eachDependency { diff --git a/fineract-accounting/build.gradle b/fineract-accounting/build.gradle index cfde64873a0..73f0c5359f8 100644 --- a/fineract-accounting/build.gradle +++ b/fineract-accounting/build.gradle @@ -19,28 +19,9 @@ description = 'Fineract Accounting' apply plugin: 'java' -apply plugin: 'eclipse' +apply plugin: 'org.springframework.boot' apply plugin: 'io.freefair.lombok' -compileJava.doLast { - def mainSS = sourceSets.main - def source = mainSS.java.classesDirectory.get() - copy { - from file("src/main/resources/jpa/accounting/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" - } -} - configurations { providedRuntime // needed for Spring Boot executable WAR providedCompile @@ -65,7 +46,6 @@ configurations { apply from: 'dependencies.gradle' // Configuration for the modernizer plugin -// https://github.com/andygoossens/gradle-modernizer-plugin modernizer { ignoreClassNamePatterns = [ '.*AbstractPersistableCustom', @@ -74,28 +54,10 @@ modernizer { ] } -// If we are running Gradle within Eclipse to enhance classes with OpenJPA, -// set the classes directory to point to Eclipse's default build directory -if (project.hasProperty('env') && project.getProperty('env') == 'eclipse') { - sourceSets.main.java.outputDir = new File(rootProject.projectDir, "fineract-accounting/bin/main") -} - -eclipse { - project { - buildCommand([ LaunchConfigHandle: "/.externalToolBuilders/OpenJPA Enhance Builder.launch" ], 'org.eclipse.ui.externaltools.ExternalToolBuilder') - } -} - -/* 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 { - java { - exclude '**/core/boot/tests/**' - } - } - } +tasks.withType(JavaCompile) { + options.compilerArgs += [ + '-Amapstruct.suppressGeneratorTimestamp=true', + '-Amapstruct.suppressGeneratorVersionInfoComment=true', + '-Amapstruct.verbose=true' + ] }