This troubleshooting is relevant for Axon Ivy version 13.2 and newer. Further general information can be found in the introduction - Troubleshoot Java compilation errors. While migrating our own Axon Ivy projects, we encountered several compilation errors related to missing third-party libraries. Below, we show you how to fix these errors.
If you are suffering other problems related to third-party libs that are not covered here, please leave a comment.
Precondition
The following fixes only apply if your project contains the official ivy-project-parent in pom.xml. See example of my project in version 13.2 pom.xml:
<parent>
<groupId>com.axonivy.ivy.api</groupId>
<artifactId>ivy-project-parent</artifactId>
<version>13.2.0</version>
<relativePath></relativePath>
</parent>
We also expect the dependency ivy-api to be specified, e.g.:
<dependency>
<groupId>com.axonivy.ivy.api</groupId>
<artifactId>ivy-api</artifactId>
</dependency>
Problem
Together with the aforementioned ivy-project-parent, the dependency management is also available in the form of ivy-api-bom. See, for example, version 13.2 ivy-api-bom. With dependency management, we list and version internal (e.g. Public API) and third-party dependencies that will be available at runtime. Where "at runtime" means when the project is deployed to the engine, i.e., the Axon Ivy Engine bundles and provides all of these libraries.
In contrast, by default, not all third-party libraries are provided at design time when developing the Java part of your project or building it with Maven. The ivy-api dependency intentionally ships only a minimal, essential subset of libs to keep the development classpath small. This is one possible cause of compilation errors. The good news is that it can be easily resolved, as shown below.
Example solutions
The symptoms and solutions are always the same. Symptoms: The IDE cannot resolve the Java imports in your project, or Maven compilation errors occur for the same reason. Solution: Add the missing dependency to pom.xml.
org.apache.poi
Imports from org.apache.poi.* cannot be resolved. Add the following dependency to the pom.xml (no version or scope is needed because it is preconfigured in ivy-api-bom dependency management):
<dependency>
<groupId>com.axonivy.ivy.api</groupId>
<artifactId>ivy-poi-api</artifactId>
</dependency>
org.apache.httpcomponents
Imports from org.apache.http.* cannot be resolved. Add the following dependency to the pom.xml (no version is needed because it is preconfigured in ivy-api-bom dependency management):
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<scope>provided</scope>
</dependency>
org.hibernate.orm
Imports from org.hibernate.* cannot be resolved. Add the following dependency to the pom.xml (no version is needed because it is preconfigured in ivy-api-bom dependency management):
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
org.glassfish.jersey
Imports from org.glassfish.jersey.* cannot be resolved. Add the following dependency to the pom.xml (no version or scope is needed because it is preconfigured in ivy-api-bom dependency management):
⚠ This should only be necessary if you add your own REST feature or extension to the REST stack. This is also the reason why we call it SPI. SPI stands for 'Service Provider Interface', which is an API intended to be implemented or extended by a third party.
<dependency>
<groupId>com.axonivy.ivy.spi</groupId>
<artifactId>ivy-rest-jersey-spi</artifactId>
</dependency>
org.apache.cxf
Imports from org.apache.cxf.* cannot be resolved. Add the following dependency to the pom.xml (no version or scope is needed because it is preconfigured in ivy-api-bom dependency management):
⚠ This should only be necessary if you add your own CXF feature or extension to the CXF stack. This is also the reason why we call it SPI. SPI stands for 'Service Provider Interface', which is an API intended to be implemented or extended by a third party.
<dependency>
<groupId>com.axonivy.ivy.spi</groupId>
<artifactId>ivy-webservice-cxf-spi</artifactId>
</dependency>