Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devel:documentation:quickstart:dev:ide:eclipse [2022/07/12 13:25] janatam [Implementing a ConnId connector] |
devel:documentation:quickstart:dev:ide:eclipse [2024/01/09 08:27] (current) koulaj [Install Tomcat] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Eclipse ====== | ====== Eclipse ====== | ||
+ | |||
{{tag> IDE}} | {{tag> IDE}} | ||
Configuration quickstart for developing CzechIdM in Eclipse. | Configuration quickstart for developing CzechIdM in Eclipse. | ||
- | |||
====== Install Eclipse ====== | ====== Install Eclipse ====== | ||
- | Download the last stable version of Eclipse from Eclipse download page. When running the installer, choose "IDE for Java EE Developers" | + | Download the last stable version of Eclipse from Eclipse download page. When running the installer, choose "IDE for Java EE Developers" |
- | It is advised to download Eclipse directly from download page, since when installing from distribution repositories via dnf or yum, you are not able to choose from distinct Eclipse editions. | + | |
If you installed Java separately from your system libraries, you should run Eclipse with the specified JDK: | If you installed Java separately from your system libraries, you should run Eclipse with the specified JDK: | ||
+ | |||
<code bash> | <code bash> | ||
cd / | cd / | ||
export JAVA_HOME=/ | export JAVA_HOME=/ | ||
./eclipse | ./eclipse | ||
- | </ | ||
- | Next set the correct Java Runtime in Eclipse: | ||
- | Window -> Preferences -> Java -> Installed JREs -> button Add... -> Standard VM - Next. In the following window, fill the "JRE home" with the path to JDK, then click Finish | ||
- | Remove Eclipse pom.xml error - `Plugin execution not covered by lifecycle configuration: | + | </code> |
+ | Next set the correct Java Runtime in Eclipse: Window → Preferences → Java → Installed JREs → button Add… → Standard VM - Next. In the following window, fill the "JRE home" with the path to JDK, then click Finish | ||
+ | Remove Eclipse pom.xml error - `Plugin execution not covered by lifecycle configuration: | ||
====== Import project ====== | ====== Import project ====== | ||
- | Open Eclipse and choose to import project from existing Maven projects: | + | Open Eclipse and choose to import project from existing Maven projects: File → Import |
- | File -> Import | + | |
- | Choose the location of your repository from file explorer, i.e. < | + | Choose the location of your repository from file explorer, i.e. < |
In the " | In the " | ||
Line 49: | Line 47: | ||
Finish. Project should be imported. | Finish. Project should be imported. | ||
- | **Set the " | + | **Set the " |
- | Right click " | + | |
====== Metamodel generation ====== | ====== Metamodel generation ====== | ||
Line 71: | Line 67: | ||
This setup has to be done for modules **core-api**, | This setup has to be done for modules **core-api**, | ||
- | **Note:** If you don't set metamodel generation, you will see Java problems like '' | + | **Note: |
- | * Go to Project | + | * Go to Project |
- | * Go to Project | + | * Go to Project |
- | If this solution didn't help and you still see the '' | + | If this solution didn't help and you still see the '' |
====== Build the Project ====== | ====== Build the Project ====== | ||
- | After that you can build the projects from Eclipse by Project | + | After that you can build the projects from Eclipse by Project |
- | If you see some dependency errors try this approach: | ||
- | |||
- | Right-click the project " | ||
- | |||
- | If dependency errors still remain, for all projects: Right click on the project -> Maven -> Update Project... -> click Select All -> Click OK | ||
====== Install Tomcat ====== | ====== Install Tomcat ====== | ||
- | Download Tomcat | + | Download Tomcat |
- | Next we will install Tomcat as a Server to the Eclipse: | + | Next we will install Tomcat as a Server to the Eclipse: |
- | Show the tab " | + | Create new server: In the tab " |
- | + | ||
- | Create new server: In the tab " | + | |
- | + | ||
- | For „Tomcat installation directory“ select the path to the installed Tomcat directory. As " | + | |
Add idm-app as an application to Tomcat: Right-click on the Tomcat server, choose "Add and Remove" | Add idm-app as an application to Tomcat: Right-click on the Tomcat server, choose "Add and Remove" | ||
Optionally set some other options for the server: Double-click on the Tomcat server, then | Optionally set some other options for the server: Double-click on the Tomcat server, then | ||
+ | |||
* in the section " | * in the section " | ||
* in the section " | * in the section " | ||
+ | |||
====== Deploy changes without reloading ====== | ====== Deploy changes without reloading ====== | ||
Line 110: | Line 99: | ||
- Double-click on the Tomcat server, in the section " | - Double-click on the Tomcat server, in the section " | ||
- | - Switch to the " | + | - Switch to the " |
- Save changes in the Tomcat server configuration | - Save changes in the Tomcat server configuration | ||
- Start the Tomcat server in " | - Start the Tomcat server in " | ||
Line 116: | Line 105: | ||
====== Run unit & integration tests ====== | ====== Run unit & integration tests ====== | ||
- | When you want to run unit tests, you must switch to Maven profile **test**. Otherwise some tests (especially those which use database connection) may fail. | + | When you want to run unit tests, you must switch to Maven profile **test**. Otherwise some tests (especially those which use database connection) may fail. Set the " |
- | Set the " | + | If you want to run only tests in some class: |
- | If you want to run only tests in some class: | + | < |
+ | 1) open this class, | ||
+ | 2) right click on the class name, | ||
+ | 3) choose Run As → JUnit Test. | ||
+ | |||
+ | </ | ||
====== Common development & tips ====== | ====== Common development & tips ====== | ||
Line 127: | Line 121: | ||
If Tomcat server fails to start, try following: | If Tomcat server fails to start, try following: | ||
- | | + | |
+ | | ||
* Check build errors - check that the tab Markers or Problems doesn' | * Check build errors - check that the tab Markers or Problems doesn' | ||
* Try Clean/ | * Try Clean/ | ||
* Try restarting Eclipse. | * Try restarting Eclipse. | ||
- | The exception: | + | The exception: |
- | < | + | |
- | org.springframework.context.ApplicationContextException: | + | |
- | ...... | + | |
- | Error creating bean with name ' | + | |
- | </ | + | |
- | Another possible issue may be an exception like this one: | + | In such case, go to Windows → Preferences → Installed JREs→ edit JRE and add to default VM arguments '' |
- | < | + | |
- | java.util.concurrent.ExecutionException: | + | Another possible issue may be an exception like this one: '' |
- | Caused by: org.apache.catalina.LifecycleException: | + | |
- | | + | If you see this, make sure that |
- | Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: | + | |
- | | + | |
- | </ | + | |
- | If you see this, make sure that | ||
* you have the project idm-core-test-api open | * you have the project idm-core-test-api open | ||
- | * in Properties of the idm-core-impl (or any problematic project), check Java Build Path and make sure that each test folder has the Output folder set to test-classes. | + | * in Properties of the idm-core-impl (or any problematic project), check Java Build Path and make sure that each test folder has the Output folder set to test-classes. |
- | {{ : | + | {{ .: |
+ | |||
+ | See below: If you have a problem in not being able to Add and Remove, try to open idm-app, look at Properties, Project Facets and check you have the correct version of **Java ** (should be 11) abd **Dynamic Web Module ** (3.1): {{ .: | ||
+ | |||
+ | ===== Maven build passes, but Eclipse shows errors ===== | ||
+ | |||
+ | It can happen that Maven builds the project fine, but eclipse Project -> Clean will throw an error, such as: | ||
+ | |||
+ | < | ||
+ | Failed to execute mojo org.apache.maven.plugins: | ||
+ | |||
+ | org.eclipse.core.runtime.CoreException: | ||
+ | at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeMojo(MavenExecutionContext.java: | ||
+ | at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.lambda$0(MavenExecutionContext.java: | ||
+ | at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java: | ||
+ | at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java: | ||
+ | at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java: | ||
+ | at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java: | ||
+ | at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.lambda$2(MavenBuilderImpl.java: | ||
+ | |||
+ | </ | ||
+ | |||
+ | In that case, update the Maven project (right click project -> Maven -> Update Project. | ||
- | If you have a problem in not being able to Add and Remove, try to open idm-app, look at Properties, Project Facets and check you have the correct version of Java: | ||
- | {{ : | ||
===== Update project after pulling new version ===== | ===== Update project after pulling new version ===== | ||
When you pull new version of the project from Git and there were some changes including Maven dependencies (e.g. newer version of some artifact), you should update your project: | When you pull new version of the project from Git and there were some changes including Maven dependencies (e.g. newer version of some artifact), you should update your project: | ||
+ | |||
* select all projects | * select all projects | ||
- | * right-click and choose Maven -> Update Project | + | * right-click and choose Maven → Update Project The IDE will update dependencies and rebuild the projects if necessary. |
- | + | ||
- | The IDE will update dependencies and rebuild the projects if necessary. | + | |
===== Implementing a ConnId connector ===== | ===== Implementing a ConnId connector ===== | ||
- | We came across problematic behavior of Eclipse when implementing a ConnId connector. If you develop the connector that is a dependency of CzechIdM and the same connector (in the same version) is opened in Eclipse, then Tomcat with CzechIdM may fail to start with the following exception: | + | We came across problematic behavior of Eclipse when implementing a ConnId connector. If you develop the connector that is a dependency of CzechIdM and the same connector (in the same version) is opened in Eclipse, then Tomcat with CzechIdM may fail to start with the following exception: |
- | + | ||
- | < | + | |
- | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: | + | |
- | Injection of autowired dependencies failed | + | |
- | .... | + | |
- | nested exception is org.springframework.beans.BeanInstantiationException: | + | |
- | + | ||
- | </ | + | |
If you encounter this exception and you want to use Debug server mode for implementing the connector (deploying without restarts), try the following steps: | If you encounter this exception and you want to use Debug server mode for implementing the connector (deploying without restarts), try the following steps: | ||
Line 181: | Line 178: | ||
<code xml> | <code xml> | ||
- | | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | </ | + | </ |
- | </ | + | </ |
- | </ | + | </ |
- | </ | + | </ |
</ | </ | ||
Line 222: | Line 219: | ||
META-INF/ | META-INF/ | ||
... | ... | ||
+ | |||
</ | </ | ||
Line 236: | Line 234: | ||
By standard Maven build I mean running '' | By standard Maven build I mean running '' | ||
- | |||
===== Stucked Eclipse settings ===== | ===== Stucked Eclipse settings ===== | ||
- | If the error you see during the build is not one of frequently known, you can try deleting " | + | If the error you see during the build is not one of frequently known, you can try deleting " |
- | Best way to restart module settings is to delete problematic module, then do Project | + | |
+ | ====== Troubleshooting - stuck Eclipse module build ====== | ||
+ | |||
+ | Sometimes, Eclipse stucks after pulling new version of an external (non-core) module. The module' | ||
+ | |||
+ | The following guide describes recovery from such situation for development environment on Windows. | ||
+ | |||
+ | Suppose that an external module [idm-extmod] is stuck. | ||
+ | |||
+ | - Eclipse menu: switch off Project → Build automatically | ||
+ | - End task Eclipse in Windows Task manager | ||
+ | - Start Eclipse | ||
+ | - Right-click on idm-app module → Maven → Update project → click " | ||
+ | - Right-click on [idm-extmod] → Delete → leave unchecked the " | ||
+ | - Go to '' | ||
+ | - Go to '' | ||
+ | - In Eclipse: File → Import → Existing Maven Project, select the [ModuleDir]/ | ||
+ | - Right-click on idm-app module → Properties → Deployment Assembly → Add, select the [idm-extmod] module | ||
+ | - Eclipse menu: switch on Project → Build automatically | ||
+ | - Right-click on idm-app module → Maven → Update project → click " | ||
+ | - Repeat step 8: Right-click on idm-app module → Properties → Deployment Assembly → Add, select the [idm-extmod] module | ||
+ | - Run the server | ||
+ | - Reconfigure the test/debug environment: | ||