This guide helps you diagnose and resolve common issues with the Akka OpenAPI Maven Plugin.
Symptom: The plugin outputs "No @HttpEndpoint annotated classes found"
Causes and Solutions:
-
Classes not compiled
# Ensure classes are compiled before the plugin runs mvn clean compile -
Wrong package scanning
<configuration> <scanPackages> <package>com.example.endpoints</package> <!-- Check this matches your package --> </scanPackages> </configuration>
-
Missing Akka SDK dependency
<dependency> <groupId>io.akka</groupId> <artifactId>akka-javasdk</artifactId> <version>3.0.2</version> </dependency>
-
Classes in test scope
- The plugin only scans main source classes, not test classes
- Move endpoint classes to
src/main/java
Symptom: Error message "No plugin descriptor found at META-INF/maven/plugin.xml"
Cause: Running mvn compile in a multi-module project without installing the plugin first.
Solution:
# Install all modules first
mvn clean install -DskipTests
# Or build from the parent project
mvn clean compile -N && mvn compileSymptom: "Failed to load class" or "ClassNotFoundException" warnings
Causes and Solutions:
-
Missing dependencies
- Ensure all required dependencies are in compile scope
- Check for transitive dependency conflicts
-
Dependency version conflicts
# Check for dependency conflicts mvn dependency:tree -
Circular dependencies
- The plugin handles most circular references
- If issues persist, simplify your class hierarchy
Symptom: "OpenAPI validation failed" error
Common Validation Issues:
-
Missing required fields
<configuration> <apiTitle>My API</apiTitle> <!-- Required --> <apiVersion>1.0.0</apiVersion> <!-- Required --> </configuration>
-
Invalid schema references
- Check that all referenced types are accessible
- Ensure DTOs are in scanned packages
-
Duplicate operationIds
- Each operation must have a unique operationId
- Rename methods if duplicates occur
To see detailed validation errors:
mvn compile -X 2>&1 | grep -A10 "validation"To skip validation temporarily:
<configuration>
<failOnValidationError>false</failOnValidationError>
</configuration>Symptom: Incorrect or missing schema properties
Solutions:
-
Add Jackson annotations for proper naming
@JsonProperty("firstName") private String firstName;
-
Use Jakarta Validation for constraints
@NotBlank @Size(min = 1, max = 100) private String name;
-
Check for generic type issues
- Use concrete types when possible
- Avoid raw generic types
Symptom: Schema references to "Map" fail validation
Cause: Generic Map types require special handling
Solution: The plugin sanitizes schema names for Map types. If you see issues:
// Instead of Map<String, Object>, use a concrete type
public class CustomAttributes {
private String key;
private String value;
}Enable debug output for detailed logging:
mvn compile -XKey debug messages to look for:
- "Scanning for Akka HTTP endpoints"
- "Found N HTTP endpoint class(es)"
- "Generating schema for: ClassName"
- "OpenAPI specification generated: path/to/file"
By default, the plugin runs during the compile phase. To verify it's running:
mvn compile -X 2>&1 | grep "akka-openapi"To change the phase:
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>Symptom: Dependencies not found during schema generation
Check classpath:
mvn dependency:build-classpathEnsure compile scope:
<dependency>
<groupId>com.example</groupId>
<artifactId>shared-types</artifactId>
<scope>compile</scope> <!-- Not provided or runtime -->
</dependency>For multi-module projects:
-
Build order matters
<modules> <module>shared-types</module> <!-- Build first --> <module>api-module</module> <!-- Then API with plugin --> </modules>
-
Use reactor build
mvn clean install -pl api-module -am
-
Plugin should be in API module only
- Don't add the plugin to parent POM
- Add it to the module with endpoints
The plugin uses Jackson 2.18.x. If you have version conflicts:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.18.2</version>
</dependency>
</dependencies>
</dependencyManagement>The plugin tracks Akka SDK 3.5.17 as the current reference version. For other versions:
- Check annotation package names haven't changed
- Verify HTTP annotations are available:
import akka.javasdk.annotations.http.HttpEndpoint; import akka.javasdk.annotations.http.Get;
If you can't resolve your issue:
-
Check existing issues
-
Create a new issue with
- Java version (
java -version) - Maven version (
mvn -version) - Akka SDK version
- Full error message
- Minimal reproducing example
- Java version (
-
Include debug output
mvn compile -X > debug.log 2>&1