IDEA
Configuration quickstart for developing CzechIdM in IntelliJ IDEA.
Import project
- Open Idea and choose to Import project (File → New → Project from Existing Sources)
- Import the
/–path–/CzechIdM/Realization/backend/aggregator
project, where–path–
is wherever you pulled your sources, click Next - The aggregator project should import all dependencies automatically, give it some time.
- Next. Next… Project should be imported.
- Make sure to set dev profile in the maven panel on the right
- You should be good to go.
Metamodel generation
After creating the project, make sure following modules are available in explorer:
- ic
- acc
- core-api
- core-impl
- core-test-api
To set up metamodel generation, go to "File → Settings → Build, Execution, Deployment → Compiler, Annotation Processors" and tick "Enable annotation processing". Now rebuild the project.
Code style
Go to "File → Settings → Editor → Code style → Java". On the first tab, "Tabs and indents", tick "Use tab character". On next tab "Imports" put 999 to "Class count to use import with '*'" and "Names count to use static imports with '*'.
Next adjust the Import Layout on the bottom of the window as:
static all other, blank, java.*, blank, javax.*, blank, org.*, blank, com.*, blank, all other imports
Configure test runner
To create test run configuration for all modules (including 'acc'), go to Run/Debug Configuration, click '+' and choose 'JUnit'. Use following settings:
- Test kind: All in package
- Package: eu.bcvsolutions.idm
- Search for tests: whole project
- Before launch: Build
- Add to VM options following: -ea -Dspring.profiles.active=test
Save the configuration and test it by running. Tests from all modules should be executed.
Launch on Tomcat
First of all make sure that you have Tomcat 9.0 installed. Then chose Tomcat server in Run/Debug Configurations in IDEA. Set URL to "http://localhost:8080/idm-backend/api/v1/status". On a "Deployment" tab set Application context to idm-backend/
. Apply and try to launch the project on server. At this point I had an error that said something like "name or service not known", there is the link that helped me solving this error: "https://stackoverflow.com/questions/19068977/intellij-cant-start-simple-web-application-unable-to-ping-server-at-localhost".
TIP 01: Deploy exploded artefact instead of compressed one.
TIP 02: If there is nothing deployed to the server check File → Project Structure → Artefacts tab. Add all modules you want to deploy to the artefact you deploy. This should happen automatically by Maven but sometimes it doesn't.
Importing a Module
To develop a module alongside main CzechIdm, import the module from Project Structure > Project Settings > Modules > Right click in the list of modules > Add > Import Module
When the module is imported, go to Artifacts tab and drag the module artifact over idm-backend.war.
Then rebuild the project.
Troubleshooting
If you see errors with missing dependencies, try to reload Maven profiles (double-shift > reload Maven).
If that doesn't help, try to rebuild project from command line mvn clean install -DskipTests