Search code examples
javaspringartificial-intelligencellamaollama

Could not find org.springframework.ai


I'm trying to integrate Llama3 in my spring application by using the following documentation: https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/api/chat/ollama-chat.html

When building the application with the added dependency:

 implementation 'org.springframework.ai:spring-ai-ollama-spring-boot-starter'

I got the following error:

Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find org.springframework.ai:spring-ai-ollama-spring-boot-starter:.

This github issue https://github.com/spring-projects/spring-ai/issues/194 also doesn't help. After changing the path based on a comment there to:

    implementation 'org.springframework.experimental.ai:spring-ai-ollama-spring-boot-starter'

I got the following error:

Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find org.springframework.experimental.ai:spring-ai-ollama-spring-boot-starter:

Solution

  • If you go to the maven repository of the mentioned dependency, you will see that the dependency is relocated. To solve this problem, simply change the dependency location to the correct one:

    implementation 'io.springboot.ai:spring-ai-ollama-spring-boot-starter:1.0.3'
    

    It is also worth considering to include Spring AI Bill of Materials (BOM) as noted by @M.Deinum's comment to avoids the need for you to specify and maintain the dependency versions yourself:

        implementation platform("io.springboot.ai:spring-ai-bom:1.0.3")
        // Replace the following with the starter dependencies of specific modules you wish to use
        implementation 'io.springboot.ai:spring-ai-ollama-spring-boot-starter'