For all code in monorepo + hoover.
These setup instructions are aimed at developing in IntelliJ IDEA, but hopefully should be similar in Eclipse.
-
Create a parent directory
Create a directory where all the repositories, including this one, will be cloned e.g.
mkdir ~/projects/EMAP
-
Clone repositories
This repo is now a monorepo that contains the source code from several pre-existing repos (Emap-Core Emap-Interchange Inform-DB emap-hl7-processor).
cd ~/projects/EMAP git clone https://github.com/UCLH-DHCT/emap.git git clone https://github.com/inform-health-informatics/hoover.git
-
Open project in IntelliJ IDEA
File > New > New Project From existing sources and select this repository directory (e.g.
~/projects/EMAP/emap
). When prompted, choose "Create project from existing sources""Unmark All" if prompted to select source files for the project.
-
Add Maven projects
File > Project Structure > Modules
Click the plus to add a new project and select the following
pom.xml
filescore/pom.xml
emap-interchange/pom.xml
emap-star/pom.xml
- NOT to be confused withemap/emap-star/emap-star/pom.xml
(which contains the Hibernate entity definitions, but requires the annotation preprocessor)!hl7-reader/pom.xml
../hoover/pom.xml
(optional for running within UCLH, outside this repo)
If you add one by mistake, you can delete the project
-
Reload Maven projects
In the
Maven
pane (which should now have appeared on the top right of the IDE), click Reimport all maven projects or Reload
-
Point to correct Java versions
There are several places in IntelliJ that relate to the java version used. These settings are sometimes correctly set from the maven config but you may want to double check in case of errors.
Project Structure | Project Settings | Project
(SDK to use and default language level)Project Structure | Project Settings | Modules
(per module language levels)Preferences | Build, Execution, Deployment | Compiler | Java Compiler
(Project bytecode version and per-module bytecode version)Preferences | Build, Execution, Deployment | Build Tools | Maven | Importing
(JDK for importer)At the time of writing, hoover uses java 11 and all other modules use java 17.
-
Add lombok and checkstyle plugins
Go to File > Settings > search for plugins, search lombok and checkstyle and install them
-
Setup checkstyle
To allow checkstyle to be run go to File > settings > search for checkstyle
- Set the version of checkstyle to the latest version
- Click on the
+
to add a new checkstyle configuration
Most repositories include unit tests in <repo-name>/src/test/java
.
You will probably want to set up a separate run config for each component so you can just
run the tests that are relevant.
The following modules can be set up in the same, very simple way:
- core
- hl7-reader
- emap-star
Others require some "fake" services which run in docker containers.
Creating a configuration as follows:
- Run > Edit Configurations
- Click on the
+
at the top left-hand side of the window - Select
Junit
from the drop down- Set Test kind to
All in package
- Set the package to
uk.ac.ucl.rits.inform.datasinks.emapstar
. Or set the module to e.g.core
and the package touk.ac.ucl.rits.inform
- You may also want to set logging level to TRACE for our classes by defining the environmental variable:
LOGGING_LEVEL_UK_AC_UCL=TRACE
- Set Test kind to
You can just copy this configuration for the other modules, changing the module name each time.
Go to Run > Run, which should create a window in the bottom pane
Expand here if this gives you a compilation error
This may be fixable like so:
-
Go to the maven pane on the right-hand side and run the Lifecycle
clean
goal for:Emap Star Annotations
andEmap Star Database Definition
. Thenclean
and theninstall
onEmap Star Schema
-
After this then select the
Reload All Maven Projects
icon at the top of the same pane as shown below -
You may also need to run
Generate Sources and Update Folders For All Projects
Tests can also be run individually by clicking the play button on a class within an IDE editor window.
Don't delete the fakeuds definition because it's needed for emap-in-a-box, and it will be needed if we bring the non-proprietary bits of hoover into this repo.