alibaba / spring-cloud-alibaba

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
https://sca.aliyun.com
Apache License 2.0
27.38k stars 8.16k forks source link

[AI] spring-ai: 0.8.1 dependency not found #3712

Open sichenyong opened 2 weeks ago

sichenyong commented 2 weeks ago

I get trouble when I try to learn Spring Cloud Alibaba AI:(https://sca.aliyun.com/docs/2023/user-guide/ai/quick-start/)

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2023.0.1.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>

    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-ai</artifactId>
        </dependency>
    </dependencies>

I can't import spring-ai-core:0.8.1 even if i changed the mirror of maven to aliyun repository.

here is my maven configuration file :

<mirror>
  <id>aliyunmaven</id>
  <mirrorOf>*</mirrorOf>
  <name>阿里云公共仓库</name>
  <url>https://maven.aliyun.com/repository/public</url>
</mirror>

I went to aliyun repository to search spring-ai-core:0.8.1 , but no result for it: image

I can't figure out it. what should i do ? Change the mirror?

yuluo-yx commented 2 weeks ago

Great to see you using spring cloud alibaba ai. You may have forgotten one important point

spring ai has not been published to the maven central repository yet, you need to configure the repository address additionally in maven:

yuluo-yx commented 2 weeks ago

/area ai /kind question

PeterZh6 commented 1 week ago

Hi, I also met this problem. You can try to add a remote repository to pom.xml as this will make maven search for spring-ai-core in this repository.

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

However, please note that you also need to change <mirrorOf>*</mirrorOf>, as this config redirect all the maven dependency request to aliyun maven repository. You need to change it to <mirrorOf>*,!spring-milestones</mirrorOf>to exclude spring-snapshots. note that no space between ,and ! This should solve your problem.