Cannot build Kotlin project created with Axon Initializr

Hi there, I created a new Kotlin application using your Axon Initializr tool, but I can’t get the project to build.

Steps to reproduce:

  • open the Axon Initializr tool via this link (contains all configurations pre-loaded)
  • click “Download”
  • unzip “demo.zip”
  • cd demo
  • mvn clean install

Expected outcome:

  • project should build successfully

Actual outcome:

  • build fails:
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ demo ---
[INFO]
[INFO] --- resources:3.2.0:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- compiler:3.10.1:compile (default-compile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- kotlin:1.7.10:compile (compile) @ demo ---
[INFO] Applied plugin: 'spring'
[ERROR] /Users/evanriegel/Downloads/axon-kotlin-w-kotlin-extension/src/main/kotlin/com/example/demo/DemoApplication.kt: (3, 12) Unresolved reference: springframework
[ERROR] /Users/evanriegel/Downloads/axon-kotlin-w-kotlin-extension/src/main/kotlin/com/example/demo/DemoApplication.kt: (4, 12) Unresolved reference: springframework
[ERROR] /Users/evanriegel/Downloads/axon-kotlin-w-kotlin-extension/src/main/kotlin/com/example/demo/DemoApplication.kt: (6, 2) Unresolved reference: SpringBootApplication
[ERROR] /Users/evanriegel/Downloads/axon-kotlin-w-kotlin-extension/src/main/kotlin/com/example/demo/DemoApplication.kt: (10, 2) Unresolved reference: runApplication
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.075 s
[INFO] Finished at: 2023-03-24T13:21:26-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.7.10:compile (compile) on project demo: Compilation failure: Compilation failure:
[ERROR] /Users/evanriegel/Downloads/axon-kotlin-w-kotlin-extension/src/main/kotlin/com/example/demo/DemoApplication.kt:[3,12] Unresolved reference: springframework
[ERROR] /Users/evanriegel/Downloads/axon-kotlin-w-kotlin-extension/src/main/kotlin/com/example/demo/DemoApplication.kt:[4,12] Unresolved reference: springframework
[ERROR] /Users/evanriegel/Downloads/axon-kotlin-w-kotlin-extension/src/main/kotlin/com/example/demo/DemoApplication.kt:[6,2] Unresolved reference: SpringBootApplication
[ERROR] /Users/evanriegel/Downloads/axon-kotlin-w-kotlin-extension/src/main/kotlin/com/example/demo/DemoApplication.kt:[10,2] Unresolved reference: runApplication
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Troubleshooting steps performed:

  • created a Java Axon application via the same Axon Initializr and it builds fine
  • created a Kotlin Spring Boot app via the Spring Initializr tool instead (sample link) and it builds fine too

System details:

  • macOS 13.2.1 (Ventura)
  • Maven version:
$ mvn -v
Maven home: /opt/homebrew/Cellar/maven/3.9.1/libexec
Java version: 19.0.2, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/19.0.2/libexec/openjdk.jdk/Contents/Home
  • Java version:
$ java --version
java 11.0.15 2022-04-19 LTS

Any idea what the problem is?

Found the problem: the pom.xml inside Kotlin Axon template projects is missing the Spring Boot dependency:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>
1 Like

Thanks a lot for reporting back. We are in the proces of updating the initializr. I’ll check if the updated version still has the problem.

1 Like