Skip to end of metadata
Go to start of metadata

This guide is a simple way how to start cooperate on project using IntelliJ IDEA (IDEA) environment.

Unless you really plan to modify the midPoint source code you probably do not need IntelliJ IDEA or any other heavyweight development environment. MidPoint can be easily built from the command line without an IDE. Please see the Installing MidPoint page for the details.

Thanks to:

JetBrains for providing IntelliJ IDEA - an IDE that impressed most of our development team members. IDEA makes out team much more productive.

Install JAVA

  1. Download java JDK from oracle.com http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. Select JDK 8
  3. Accept license
  4. select package for your platform
  5. Continue installation for this platform

Install IDEA

  1. Download IDEA from jetbrains.com http://www.jetbrains.com/idea/download/index.html
  2. Select the version for your operating system and download Ultimate Edition
  3. Install IntelliJ IDEA on your computer.

First run of IDEA

 

There is a very good description of IDEA setup with screenshots contributed by Deepak Natarjan: idea-midpoint-init.pdf (attachment)

 

  1. You will be asked to import settings from previous version of  IDEA. If this is first time you're using IDEA, select „I do not have a previous version of IntelliJ IDEA or I do not want to import my settings" and continue.
  2. On next screen you will be asked for license data. Enter them and continue.
  3. Agree with license politics of IDEA
  4. On a couple of next screens you will be asked to select some IDEA plugins. The choice is yours, but some of the plugins are essential for working on midpoint. On first screen, select the Git VCS Integration plugin.
  5. Select these Web/JavaEE Technology plugins: 
  • Bean Validation
  • Database
  • FreeMarker
  • Hibernate
  • JSF
  • Java EE
  • Java Server Pages
  • Persistance Frameworks
  • SQL
  • Spring Data
  • Spring
  • Spring OSGi
  • Spring Security
  • pring Web Services
  • Spring-AOP and @AspectJ
  • Velocity
  • Web Services

     6. Select Application Server Plugin: Tomcat
     7. Select HTML/Javascript Development Plugins:

  • CSS
  • HTML Tools
  • Inspection-JS
  • JavaScript Debugger
  • JavaScript Intention Power Pack
  • W3C Validators

     8. Select Other plugins:

  • Ant
  • AspectJ
  • Copyright
  • Eclipse
  • Groovy
  • Inspection Gadgets
  • JUnit
  • Maven
  • Maven Integration Extension
  • TestNG-J
  • XpathView + XSLT

     9. Click Finish

Setup MidPoint in IDEA

  1. Click File -> New Project
  2. Select 'Create project from scratch' -> Next
  3. Fill fields Project name and select Project files location -> Next -> Finish
  4. When new project is created, click VCS in top menu -> Checkout from Version control -> Git
  5. Click the '+' icon, fill in https://svn.evolveum.com/midpoint/ -> click OK
  6. Click on the midpoint repository -> Click Checkout.
  7. Select root folder of your project -> Click OK on several next screens, this will take a while
  8. Click on VCS again, select Enable Subversion Checkout Control -> OK
  9. In bottom menu, click on Event Log -> Click on the Settings Icon in left menu
  10. In AspectJ Group, Select 'No popup' option -> OK
  11. Now you'll need to install Maven 3 from http://maven.apache.org/download.html.
  12. On top menu, click Run -> Edit Configurations
  13. Click on '+' icon and select Maven
  14. In Parameters Section, choose your working directory, put 'clean install' in command line and 'default' in Profiles. Name your configuration as well.
  15. Click on General options. Unselect 'Use project settings' and in 'snapshot update policy' add value 'Do Not Update'.
  16. You may also need to set Maven home directory either to your M2_HOME classpath variable or override it to maven installation folder.
  17. In Runner option panel, unselect 'Use project settings' and mark 'Skip tests' value. Click OK.
  18. In main screen, select your previously edited configuration and click on green arrow icon. This will run the build of MidPoint. It may take up to several dozens of minutes depending on your hardware and internet connection speed.
  19. Download and install Tomcat 7 from http://tomcat.apache.org/index.html
  20. To run midpoint from IDEA, you will need to create user configuration. Click Run -> Edit Configurations.
  21. Click on '+' button in upper left corner of the screen, choose Tomcat -> Local.
  22. Name your configuration, then click on 'Configure' button located left to Application Server option.
  23. Edit Tomcat home and Tomcat base directory. -> OK
  24. Check  the 'Start browser' option and type 'http://localhost:8080/midpoint/login' in startup page. -> OK.
  25. Now run your new Tomcat configuration the same way like maven build before. Midpoint now should open in your default web browser.

Add Generated Sources

MidPoint build generates some source code during build. These are especially classes generated from XSD schemas. You need to add the folders that contain generated classes as source folders so IDEA can see them.

  1. From the command-line, run the build once: mvn[w] clean package
  2. Go to the infra/schema project and open module settings (right click and select Open Module settings or press F4)
  3. In the "Sources" tab click on "target" and uncheck the "Excluded" mark (in the "Mark as" bar)
  4. Expand "target/generated" and mark "target/generated/cfx" as "Sources"
  5. Mark all other sub-directories of "target" as "Excluded" (classes, cxf-codegen-plugin-markers, maven-archiver, ...)
  6. Repeat steps 1~4 for the model-client project.
  7. Click OK

Setup Copyright Notices

Select Settings -> Editor -> Copyright -> Copyright Profiles and create a new profile (called e.g. midPoint) like this:

Use the following copyright text:

Then select midPoint in the "Default project copyright" in the Settings -> Editor -> Copyright panel.

Other Tips

  • Remove Spring Facets from the Project Structure (File -> Project Structure -> Facets). These do not work well with maven-based spring configuration. If the faces are present you may get false errors about duplication of some spring beans.
  • Set the modules dummy-connector and dummy-connector-fake as ignored (in icf-connectors module). Right-click on the modules, select Maven -> Ignore projects. This is needed because of an issue with IDEA-maven integration. IDEA ignores maven build instructions and provides these modules on a classpath in a different form than the test code expects them. The test code then cannot find Dummy connector and fails. (But don't let IDEA to remove the modules from the project structure, otherwise midPoint won't compile.)
  • No labels