From e295bef7434fede4659abd0a60457289b8e2a0d7 Mon Sep 17 00:00:00 2001
From: Petri Tuomola
Date: Tue, 12 May 2020 21:27:40 +0300
Subject: [PATCH] FINERACT-918: Changes to running and debugging in Eclipse
---
README.md | 18 ++++++++++++++++++
config/fineractdev-eclipse-preferences.epf | 4 ++--
.../OpenJPA Enhance Builder.launch | 10 ++++++++++
fineract-provider/build.gradle | 14 ++++++++++++++
.../main/resources/static/api-docs/apiLive.htm | 2 +-
5 files changed, 45 insertions(+), 3 deletions(-)
create mode 100644 fineract-provider/.externalToolBuilders/OpenJPA Enhance Builder.launch
diff --git a/README.md b/README.md
index b96c402a4..f23fc38bc 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,24 @@ Run the following commands, very similarly to how [.travis.yml](.travis.yml) doe
1. `./gradlew clean integrationTest`
+Instructions to run and debug in Eclipse IDE
+============
+
+It is possible to run Fineract in Eclipse IDE and also to debug Fineract using Eclipse's debugging facilities.
+To do this, you need to create the Eclipse project files and import the project into an Eclipse workspace:
+
+1. Create Eclipse project files into the Fineract project by running `./gradlew cleanEclipse eclipse`
+2. Import the fineract-provider project into your Eclipse workspace (File->Import->General->Existing Projects into Workspace, choose root directory fineract/fineract-provider)
+3. Do a clean build of the project in Eclipse (Project->Clean...)
+3. Run / debug Fineract by right clicking on org.apache.fineract.ServerApplication class and choosing Run As / Debug As -> Java Application. All normal Eclipse debugging features (breakpoints, watchpoints etc) should work as expected.
+
+If you change the project settings (dependencies etc) in Gradle, you should redo step 1 and refresh the project in Eclipse.
+
+You can also use Eclipse Junit support to run tests in Eclipse (Run As->Junit Test)
+
+Finally, modifying source code in Eclipse automatically triggers hot code replace to a running instance, allowing you to immediately test your changes
+
+
Instructions to run using Docker and docker-compose
===================================================
diff --git a/config/fineractdev-eclipse-preferences.epf b/config/fineractdev-eclipse-preferences.epf
index cf37f62d6..8019350f3 100644
--- a/config/fineractdev-eclipse-preferences.epf
+++ b/config/fineractdev-eclipse-preferences.epf
@@ -11,8 +11,8 @@
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.compliance=1.8
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.compliance=11
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
diff --git a/fineract-provider/.externalToolBuilders/OpenJPA Enhance Builder.launch b/fineract-provider/.externalToolBuilders/OpenJPA Enhance Builder.launch
new file mode 100644
index 000000000..de36ed64a
--- /dev/null
+++ b/fineract-provider/.externalToolBuilders/OpenJPA Enhance Builder.launch
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index b425c1060..2b932afb3 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -158,6 +158,20 @@ repositories {
// mavenLocal() // useful for local dev using MariaDB4j SNAPSHOTs (not needed for real-world non-SNAPHOT builds)
}
+// 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, "bin/main")
+}
+
+eclipse
+{
+ project {
+ buildCommand([ LaunchConfigHandle: "/.externalToolBuilders/OpenJPA Enhance Builder.launch" ], 'org.eclipse.ui.externaltools.ExternalToolBuilder')
+ }
+}
+
openjpa {
includes = ['**/AbstractPersistableCustom.class', '**/domain/*.class']
enhance {
diff --git a/fineract-provider/src/main/resources/static/api-docs/apiLive.htm b/fineract-provider/src/main/resources/static/api-docs/apiLive.htm
index 0c8b5c0b7..e85a44651 100644
--- a/fineract-provider/src/main/resources/static/api-docs/apiLive.htm
+++ b/fineract-provider/src/main/resources/static/api-docs/apiLive.htm
@@ -4328,7 +4328,7 @@ function executeAjaxRequest(url, verbType, jsonData, authKey, successFunction, e
Two-Factor authentication and delivery methods can be configured via
- the /twofactor/configure endpoint.
+ the /twofactor/configure endpoint.