spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/index.html
Apache License 2.0
3.12k stars 776 forks source link

Maven could not find spring-ai-bom #362

Closed RuiUma closed 7 months ago

RuiUma commented 7 months ago

I used cmd "spring boot add ai" to add maven dependency, but maven could not find it.

Environment Spring boot: 3.2.3 Maven: 3.9.5 spring ai version: 0.8.1-SNAPSHOT

when using maven to install dependencies as follows

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.ai</groupId>
                <artifactId>spring-ai-bom</artifactId>
                <version>0.8.1-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

and I got error here.

[ERROR] Non-resolvable import POM: The following artifacts could not be resolved: org.springframework.ai:spring-ai-bom:pom:0.8.1-SNAPSHOT (absent): Could not find artifact org.springframework.ai:spring-ai-bom:pom:0.8.1-SNAPSHOT @ line 23, column 16

I also tried version 0.8.0-SNAPSHOT and 0.7.1-SNAPSHOT, but got the same error.

XYWENJIE commented 7 months ago

Currently, Spring AI is not distributed in the central repository but rather in Spring's own Maven repository, so in order to include it, you need to add Spring's repository address in the pom.xml file.


  <repositories>
    <repository>
      <id>spring-milestones</id>
      <name>Spring Milestones</name>
      <url>https://repo.spring.io/milestone</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>spring-snapshots</id>
      <name>Spring Snapshots</name>
      <url>https://repo.spring.io/snapshot</url>
      <releases>
        <enabled>false</enabled>
      </releases>
    </repository>
  </repositories>
tzolov commented 7 months ago

@RuiUma, as pointed above, the Milestone/Snapshot artefacts are only resolvable through the Spring Snapshot/Milestone repositories. It is explained in the docs: https://docs.spring.io/spring-ai/reference/getting-started.html#repositories Let me know if we can improve the docs to avoid confusion. Also, mind that the newly released 0.8.0 milestone (we should have named it 0.8.0M1 or alike) and as a such is not published to the maven central. Having said this, we are moving quick and hopping to have our first GA soon.

greggy-laloutre commented 7 months ago

If you use a Sonatype Nexus as Artifact proxy, then your error is related to this issue : Artifactory - Bad header value content-type of pom.xml from repo.spring.io/artifactory/snapshot

markpollack commented 7 months ago

FWIW, the command spring boot add ai is resolving to add the 0.8.0 version of Spring AI, see here and adds the appropriate definition of the milestone and snapshot repositories, see here.

It seems related to the issue @greggy-laloutre mentioned and I'm not quite sure what to do about that yet. We are investigating. Will keep you posted.

markpollack commented 7 months ago

The issue on the hosting side has been fixed. Also, that infrastructure issue turned out to be a side effect of a mistake we had in the flatten pom plugin of maven, we ended up including a dependency management section in the pom that included all the dependencies that spring boot had. So both issues are now fixed. Closing, thanks for reporting. Create a new issue if you run into problems. Thanks!

danielnevesdecastro commented 5 months ago

you can add the dependency in the POM:

<repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
</repositories>