阿里云企业级互联网架构实践系列-EDAS 开发

本文档详细介绍了如何在阿里云 EDAS 中使用 Spring Cloud 进行服务开发和部署。内容涵盖 Maven 私服配置、服务依赖、服务开发、配置中心的使用以及从 Maven 到 Gradle 的改造过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. EDSA中使用spring cloud

如果需要在edas 中使用spring cloud 需要先配置maven 私服,更新maven依赖配置。基于

1.1. Maven 私服配置

注意: Maven 版本要求 3.x 及以上请在你的 Maven 配置文件 Setting 中,加入中间件私服地址

<?xml version="1.0"?>

<settings>

    <!-- 设置用户自己的本地库 -->

    <!-- <localRepository>/Users/../.m2/repository</localRepository> -->

    <profiles>

        <profile>

            <id>nexus</id>

            <repositories>

                <repository>

                    <id>central</id>

                    <url>http://repo1.maven.org/maven2</url>

                    <releases>

                        <enabled>true</enabled>

                    </releases>

                    <snapshots>

                        <enabled>true</enabled>

                    </snapshots>

                </repository>

            </repositories>

            <pluginRepositories>

                <pluginRepository>

                    <id>central</id>

                    <url>http://repo1.maven.org/maven2</url>

                    <releases>

                        <enabled>true</enabled>

                    </releases>

                    <snapshots>

                        <enabled>true</enabled>

                    </snapshots>

                </pluginRepository>

            </pluginRepositories>

        </profile>

        <profile>

            <id>edas.oss.repo</id>

                <repositories>

                <repository>

                    <id>edas-oss-central</id>

                    <name>taobao mirror central</name>

                    <url>http://edas-public.oss-cn-hangzhou.aliyuncs.com/repository</url>

                    <snapshots>

                        <enabled>true</enabled>

                    </snapshots>

                    <releases>

                        <enabled>true</enabled>

                    </releases>

                </repository>

            </repositories>

            <pluginRepositories>

                <pluginRepository>

                    <id>edas-oss-plugin-central</id>

                    <url>http://edas-public.oss-cn-hangzhou.aliyuncs.com/repository</url>

                    <snapshots>

                        <enabled>true</enabled>

                    </snapshots>

                    <releases>

                        <enabled>true</enabled>

                    </releases>

                </pluginRepository>

            </pluginRepositories>

        </profile>

    </profiles>

    <activeProfiles>

        <activeProfile>nexus</activeProfile>

        <activeProfile>edas.oss.repo</activeProfile>

    </activeProfiles>

</settings>

1.2. Maven 依赖

以下列出了几种依赖关系,不同的依赖针对代码编写也不一样。关于以下依赖的版本信息详见 Demo 工程中的父 pom 文件。

1.2.1. 通用依赖

最少依赖,必选。

<dependency>

      <groupId>org.springframework.cloud</groupId>

      <artifactId>spring-cloud-starter-pandora</artifactId>

      <version>1.0</version>

  </dependency>

FatJar 插件依赖(该插件用于生成 FatJar ,并且默认排除 taobao-hsf.sar 这个 JAR 包,该 JAR 包在生产环境部署时会通过 -D 参数自动指定,无需打包,避免资源浪费),必选。

<plugin>

      
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

技术与健康

你的鼓励将是我最大的创作动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值