Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devel:documentation:quickstart:dev:ide:idea [2019/06/19 11:12]
klementm [Configure test runner]
devel:documentation:quickstart:dev:ide:idea [2023/12/05 08:51] (current)
kolombom [Importing a Module]
Line 7: Line 7:
 ====== Import project ====== ====== 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. +  - 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// 
-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+  - {{  .:importmaven.png?nolink&460x581  }}The aggregator project should import all dependencies automatically, give it some time. 
- +  - NextNext… Project should be imported. 
-Select profiletick 'dev', untick others. +  Make sure to set dev profile in the maven panel on the right 
- +  - {{  .:dev-profile.png?nolink&269x556  }}You should be good to go.
-Select Maven projects to import: ignore "Unknown" projects (happens if you have the source built already) and tick all "eu.bcvsolutions.idm" modulesIgnore 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 ====== ====== Metamodel generation ======
Line 31: Line 24:
   * core-test-api   * 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.+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 ====== ====== 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 '*'.+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: Next adjust the Import Layout on the bottom of the window as:
  
 <code> <code>
-static all other,  +static all other, 
-blank,  +blank, 
-java.*,  +java.*, 
-blank,  +blank, 
-javax.*,  +javax.*, 
-blank,  +blank, 
-org.*,  +org.*, 
-blank,  +blank, 
-com.*,  +com.*, 
-blank, +blank,
 all other imports all other imports
 +
 </code> </code>
 +
 ====== Configure test runner ====== ====== 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: +<note warning>This currently doesn't seem to work, alternative is to just check the test profile in Maven and run specific tests over one folder by right-click > run tests in java</note> 
 + 
 +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   * Test kind: All in package
   * Package: eu.bcvsolutions.idm   * Package: eu.bcvsolutions.idm
Line 61: Line 59:
   * Add to VM options following: -ea -Dspring.profiles.active=test   * Add to VM options following: -ea -Dspring.profiles.active=test
  
-<note important>**-Dspring.profiles.active=test** ||| This is the only way how you can run tests under profile test. It is also used for a single test.</note>+<note important>**-Dspring.profiles.active=test**  ||| This is the only way how you can run tests under profile test. It is also used for a single test.</note>
  
 Save the configuration and test it by running. Tests from all modules should be executed. 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/". 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".
 +
 +{{  .:backend-path.png?nolink&780x182  }}
 +
 +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
 +
 +{{.:screenshot2023-12-04153509.png?nolink&1035x921}}
 +
 +When the module is imported, go to Artifacts tab and drag the module artifact over idm-backend.war.
 +
 +{{.:idm-war.png?nolink&855x579}}
 +
 +Then rebuild the project.
 +
 +<note important>When you reload Maven configuration, this change will disappear and you have to re-add the module to war again</note>
 +
 +
 +===== 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''
 +
  
  • by klementm