diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index 7be54485f..49ccb8b51 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -38,12 +38,12 @@ buildscript { } dependencies { - classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.0', + classpath 'com.bmuschko:gradle-tomcat-plugin:2.5', 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0', 'org.zeroturnaround:gradle-jrebel-plugin:1.1.2', - 'org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE' // also change springDataJpaVersion above + 'org.springframework.boot:spring-boot-gradle-plugin:2.1.3.RELEASE' // also change springDataJpaVersion below classpath "org.apache.openjpa:openjpa:$openJPAVersion" - classpath 'at.schmutterer.oss.gradle:gradle-openjpa:0.2.0' + classpath 'com.radcortez.gradle:openjpa-gradle-plugin:3.0.0' classpath 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.2' } } @@ -52,10 +52,10 @@ apply plugin: "org.nosphere.apache.rat" apply plugin: 'rebel' apply plugin: 'license' apply plugin: 'war' -apply plugin: 'spring-boot' +apply plugin: 'org.springframework.boot' apply plugin: 'eclipse' apply plugin: 'idea' -apply plugin: 'tomcat' +apply plugin: 'com.bmuschko.tomcat' apply plugin: 'project-report' apply plugin: 'java' apply plugin: 'openjpa' @@ -76,13 +76,12 @@ repositories { jcenter() // mavenLocal() // useful for local dev using MariaDB4j SNAPSHOTs (not needed for real-world non-SNAPHOT builds) } -openjpa { - files = fileTree(sourceSets.main.output.classesDir).matching { - include '**/AbstractPersistableCustom.class' - include '**/domain/*.class' +openjpa { + includes = ['**/AbstractPersistableCustom.class', '**/domain/*.class'] + enhance { + enforcePropertyRestrictions true } - enforcePropertyRestrictions = true } rat { @@ -188,6 +187,7 @@ configurations { } runtime all*.exclude group: 'commons-logging' + all*.exclude module: 'jul-to-slf4j' // see FINERACT-700 re. ClassCircularityError: java/util/logging/LogRecord } /* Pick up dependencies based on the environemnt, defaults to production */ if (project.hasProperty('env') && project.getProperty('env') == 'dev') { @@ -294,7 +294,7 @@ war { from('../DISCLAIMER') { // notice the parens into "WEB-INF/" // no leading slash } - war.finalizedBy(bootRepackage) + war.finalizedBy(bootWar) } license { @@ -328,9 +328,26 @@ tomcatRunWar { configFile = file('src/test/resources/META-INF/context.xml') } +task tomcatRunWarAsDaemonForIntegrationTest(type: com.bmuschko.gradle.tomcat.tasks.TomcatRunWar) { + httpPort = 8080 + httpsPort = 8443 + stopPort = 8081 + stopKey= 'stopKey' + enableSSL = true + keystoreFile = file('src/main/resources/keystore.jks') + keystorePass = 'openmf' + configFile = file('src/test/resources/META-INF/context.xml') + daemon = true +} + +task tomcatStopAfterIntegrationTest(type: com.bmuschko.gradle.tomcat.tasks.TomcatStop) { + stopPort = 8081 + stopKey = 'stopKey' +} + /* http://stackoverflow.com/questions/19653311/jpa-repository-works-in-idea-and-production-but-not-in-gradle */ -sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDir -sourceSets.test.output.resourcesDir = sourceSets.test.output.classesDir +sourceSets.main.output.resourcesDir = sourceSets.main.java.outputDir +sourceSets.test.output.resourcesDir = sourceSets.test.java.outputDir /* Exclude maria db and embedded tomcat related files for non dev builds */ if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) { @@ -362,14 +379,14 @@ configurations { integrationTestRuntime.extendsFrom testRuntime } -task integrationTest(type:Test){ - description = "Run integration tests (located in src/integrationTest/java). Starts tomcat in daemon mode before executing the tests." - it.dependsOn war - doFirst { - tomcatRunWar.daemon = true - tomcatRunWar.execute() - } - testClassesDir = project.sourceSets.integrationTest.output.classesDir +task integrationTest(type:Test) { + description = "Run integration tests (located in src/integrationTest/java). Starts Tomcat in daemon mode before executing the tests (and stops it after)." + dependsOn war + dependsOn tomcatRunWarAsDaemonForIntegrationTest + tasks.findByName('tomcatRunWarAsDaemonForIntegrationTest').mustRunAfter 'war' + finalizedBy tomcatStopAfterIntegrationTest + + testClassesDirs = project.sourceSets.integrationTest.output.classesDirs classpath = project.sourceSets.integrationTest.runtimeClasspath } @@ -391,21 +408,27 @@ configurations.driver.each {File file -> loader.addURL(file.toURL()) } -task createDB<<{ +task createDB { description= "Creates the Database. Needs database name to be passed (like: -PdbName=someDBname)" - def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' ) - sql.execute( 'create database '+"`$dbName`" ) + doLast { + def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' ) + sql.execute( 'create database '+"`$dbName`" ) + } } -task dropDB<<{ +task dropDB { description= "Drops the specified database. The database name has to be passed (like: -PdbName=someDBname)" - def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' ) - sql.execute( 'DROP DATABASE '+"`$dbName`") + doLast { + def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' ) + sql.execute( 'DROP DATABASE '+"`$dbName`") + } } -task setBlankPassword<<{ - def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' ) - sql.execute('USE `mifosplatform-tenants`') - sql.execute('UPDATE mifosplatform-tenants.tenants SET schema_server = \'localhost\', schema_server_port = \'3306\', schema_username = \'mifos\', schema_password = \'mysql\' WHERE id=1;') +task setBlankPassword { + doLast { + def sql = Sql.newInstance( 'jdbc:mysql:thin://localhost:3306/', mysqlUser, mysqlPassword, 'org.drizzle.jdbc.DrizzleDriver' ) + sql.execute('USE `mifosplatform-tenants`') + sql.execute('UPDATE mifosplatform-tenants.tenants SET schema_server = \'localhost\', schema_server_port = \'3306\', schema_username = \'mifos\', schema_password = \'mysql\' WHERE id=1;') + } } @@ -428,8 +451,8 @@ def qualifyVersionIfNecessary(version) { } springBoot { - mainClass = 'org.apache.fineract.ServerWithMariaDB4jApplication' + mainClassName = 'org.apache.fineract.ServerWithMariaDB4jApplication' } -bootRepackage { - mainClass = 'org.apache.fineract.ServerWithMariaDB4jApplication' +bootWar { + mainClassName = 'org.apache.fineract.ServerWithMariaDB4jApplication' } diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle index 9221336cb..3dda8971b 100644 --- a/fineract-provider/dependencies.gradle +++ b/fineract-provider/dependencies.gradle @@ -27,10 +27,6 @@ dependencies { providedRuntime("org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion}") - providedCompile( -// [group: 'javax.servlet', name: 'servlet-api', version: '2.5'], - ) - compile( // [group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.3'], @@ -39,7 +35,7 @@ dependencies { [group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: springBootVersion], //[group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.0.0'], [group: 'org.springframework', name: 'spring-context-support', version: springVersion], - + [group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: springOauthVersion], [group: 'org.apache.openjpa', name:'openjpa', version: openJPAVersion], @@ -92,8 +88,8 @@ dependencies { //[group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'] [group: 'io.swagger', name: 'swagger-jersey-jaxrs', version: '1.5.15'], - [group: 'org.springframework', name:'spring-jms'], - [group: 'org.apache.activemq', name: 'activemq-broker'], + [group: 'org.springframework', name:'spring-jms', version: '4.0.7.RELEASE'], + [group: 'org.apache.activemq', name: 'activemq-broker', version: '5.9.1'], [group: 'javax.validation', name: 'validation-api', version: '2.0.0.Final'] ) diff --git a/fineract-provider/gradle/wrapper/gradle-wrapper.properties b/fineract-provider/gradle/wrapper/gradle-wrapper.properties index 44cca1e1c..6ceb14dd3 100644 --- a/fineract-provider/gradle/wrapper/gradle-wrapper.properties +++ b/fineract-provider/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jan 29 13:04:36 IST 2016 +#Wed Feb 13 23:18:32 CET 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..b65231028 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,24 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Increased memory and disabled daemon are required by gradle-tomcat-plugin +# The daemon is more pain than gain, because the Tomcat in the Gradle process does not shut down cleanly. +# TODO remove this after https://issues.apache.org/jira/browse/FINERACT-764 +org.gradle.jvmargs=-Xmx4g +org.gradle.daemon=false