IDEA
Configuration quickstart for developing CzechIdM in IntelliJ IDEA.
Import project
Open Idea and choose to create project from existing sources. Choose the location of your repository from file explorer, i.e. <path>/CzechIdM/Realization/backend, click next and choose "Import project from external model" → Maven.
Next tick "Search for projects recursively", choose a location where to "Keep project files in" (preferably different to sources location), and tick "Create IDEA modules for aggregator projects". Next.
Select profile: tick 'dev', untick others.
Select Maven projects to import: ignore "Unknown" projects (happens if you have the source built already) and tick all "eu.bcvsolutions.idm" modules. Ignore records from "target" - I'm not sure how to correctly set up the IDE to ignore these. Do not import the "gui" module. Thus you should have following modules selected:
- ic
- acc
- aggregator
Next. Project should be imported.
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
Save the configuration and test it by running. Tests from all modules should be executed.
IDEA - Community version
Build
To setup build of CzechIdM go to Run → edit configurations → click '+' and choose Maven. Continue with the same setup as in this picture.
Deploy
- To deploy setup go to Run → edit configurations → click '+' and choose 'remote'.
- Set Host to 'localhost' and Port to '8000'.
- In the 'Before launch' section click '+' → Run another configuration → choose 'Build IdM'.
- Then in the same section click '+' → add 'External Tool' → click '+' → setup see below
Setup:
- Program: 'cp'
- Parameters: idm-backend.war /path/to/tomcat/webapps/idm-backend.war
This is how Remote → Deploy profile setup looks like:
Now you can run this profile with 'Debug' button (when selected in the up right corner od ide).